better-url 0.12.0

A better URL crate.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! Setters.

use crate::prelude::*;

impl<'a> QueryLike<'a> {
    /// Either [`Query::set`] or [`FragmentQuery::set`].
    /// # Errors
    /// If [`Query::set`] returns an error, the error is returned.
    ///
    /// If [`FragmentQuery::set`] returns an error, that error is returned.
    pub fn set<'b, N: AsRef<[u8]>, T: Into<MaybeSpecialQueryValue<'b>> + Into<MaybeNonSpecialQueryValue<'b>> + Into<MaybeFragmentQueryValue<'b>>>(&mut self, name: N, index: isize, value: Option<T>) -> Result<bool, SetQueryError> {
        match self {
            Self::Query   (x) => x.set(name, index, value),
            Self::Fragment(x) => x.set(name, index, value),
        }
    }
}