Struct iref::uri::Query

source ·
pub struct Query(/* private fields */);

Implementations§

source§

impl Query

source

pub fn new<T: ?Sized + AsRef<[u8]>>( input: &T ) -> Result<&Self, InvalidQuery<&T>>

Creates a new URI query by parsing the input value

source

pub const unsafe fn new_unchecked(input: &[u8]) -> &Self

Creates a new URI query from the input value without validation.

§Safety

The input data must be a valid URI query.

source

pub fn validate(input: impl Iterator<Item = u8>) -> bool

Checks that the input iterator produces a valid URI query

source§

impl Query

source

pub const EMPTY: &'static Self = _

source§

impl Query

source

pub fn as_bytes(&self) -> &[u8]

source§

impl Query

source

pub fn as_str(&self) -> &str

source§

impl Query

source

pub fn as_pct_str(&self) -> &PctStr

Returns the query as a percent-encoded string slice.

Methods from Deref<Target = PctStr>§

source

pub fn len(&self) -> usize

Length of the decoded string (character count).

Computed in linear time. This is different from the byte length, which can be retrieved using value.as_bytes().len().

source

pub fn is_empty(&self) -> bool

Checks if the string is empty.

source

pub fn as_bytes(&self) -> &[u8]

Returns the underlying percent-encoding bytes.

source

pub fn as_str(&self) -> &str

Get the underlying percent-encoded string slice.

source

pub fn chars(&self) -> Chars<'_>

Iterate over the encoded characters of the string.

source

pub fn bytes(&self) -> Bytes<'_>

Iterate over the encoded bytes of the string.

source

pub fn decode(&self) -> String

Decoding.

Return the string with the percent-encoded characters decoded.

Trait Implementations§

source§

impl AsRef<[u8]> for Query

source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<Query> for Query

source§

fn as_ref(&self) -> &Query

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<Query> for QueryBuf

source§

fn as_ref(&self) -> &Query

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<str> for Query

source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Borrow<[u8]> for Query

source§

fn borrow(&self) -> &[u8]

Immutably borrows from an owned value. Read more
source§

impl Borrow<Query> for QueryBuf

source§

fn borrow(&self) -> &Query

Immutably borrows from an owned value. Read more
source§

impl Borrow<str> for Query

source§

fn borrow(&self) -> &str

Immutably borrows from an owned value. Read more
source§

impl Debug for Query

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Deref for Query

§

type Target = PctStr

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl Display for Query

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> From<&'a Query> for &'a [u8]

source§

fn from(value: &'a Query) -> &'a [u8]

Converts to this type from the input type.
source§

impl<'a> From<&'a Query> for &'a str

source§

fn from(value: &'a Query) -> &'a str

Converts to this type from the input type.
source§

impl Hash for Query

source§

fn hash<H: Hasher>(&self, hasher: &mut H)

Feeds this value into the given Hasher. Read more
source§

impl Ord for Query

source§

fn cmp(&self, other: &Query) -> Ordering

This method returns an Ordering between self and other. Read more
source§

impl<'a> PartialEq<&'a Query> for QueryBuf

source§

fn eq(&self, other: &&'a Query) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> PartialEq<&'a str> for Query

source§

fn eq(&self, other: &&'a str) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Query> for QueryBuf

source§

fn eq(&self, other: &Query) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq for Query

source§

fn eq(&self, other: &Query) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> PartialOrd<&'a Query> for QueryBuf

source§

fn partial_cmp(&self, other: &&'a Query) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PartialOrd<Query> for QueryBuf

source§

fn partial_cmp(&self, other: &Query) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PartialOrd for Query

source§

fn partial_cmp(&self, other: &Query) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl ToOwned for Query

§

type Owned = QueryBuf

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> QueryBuf

Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · source§

fn clone_into(&self, target: &mut Self::Owned)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<'a> TryFrom<&'a [u8]> for &'a Query

§

type Error = InvalidQuery<&'a [u8]>

The type returned in the event of a conversion error.
source§

fn try_from(input: &'a [u8]) -> Result<&'a Query, InvalidQuery<&'a [u8]>>

Performs the conversion.
source§

impl<'a> TryFrom<&'a str> for &'a Query

§

type Error = InvalidQuery<&'a str>

The type returned in the event of a conversion error.
source§

fn try_from(input: &'a str) -> Result<&'a Query, InvalidQuery<&'a str>>

Performs the conversion.
source§

impl Eq for Query

Auto Trait Implementations§

§

impl RefUnwindSafe for Query

§

impl Send for Query

§

impl !Sized for Query

§

impl Sync for Query

§

impl Unpin for Query

§

impl UnwindSafe for Query

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more