[][src]Struct async_coap_uri::UriRawComponents

pub struct UriRawComponents<'a> { /* fields omitted */ }

Struct that holds parsed URI components.

Internally, all components are referenced in raw/escaped form, but this type does provide methods for convenient decoded/unescaped access.

Instances of this type are usually created by calling a method named components() on the URI type you are working with.

That this struct implements AnyUriRef, allowing it to be used as an argument wherever a AnyUriRef is accepted.

Methods

impl<'a> UriRawComponents<'a>[src]

pub fn from_str(uri: &'a str) -> Result<UriRawComponents<'a>, ParseError>[src]

Constructs a new UriRawComponents from the given string slice, which is assumed to contain a URI-reference.

pub fn scheme(&self) -> Option<&'a str>[src]

Returns the slice of the URI that describes the URI scheme, if present. Percent encoding is not allowed in the scheme, so no decoding is required.

pub fn raw_authority(&self) -> Option<&'a str>[src]

Returns the escaped slice of the URI that contains the "authority", if present.

See UriRawComponents::authority for the percent-decoded version.

pub fn raw_userinfo(&self) -> Option<&'a str>[src]

Returns the escaped slice of the URI that contains the "userinfo", if present.

See UriRawComponents::userinfo for the percent-decoded version.

pub fn raw_host(&self) -> Option<&'a str>[src]

Returns the escaped slice of the URI that contains the "host", if present.

See UriRawComponents::host for the percent-decoded version.

pub fn port(&self) -> Option<u16>[src]

Returns the 16-bit representation of the port number, if present in the authority.

pub fn raw_path(&self) -> &'a str[src]

Returns the escaped slice of the URI that contains the "path".

See UriRawComponents::path for the percent-decoded version.

pub fn path_as_rel_ref(&self) -> &'a RelRef[src]

Returns the subset of this URI that is a path, without the scheme, authority, query, or fragment. Since this is itself a valid relative URI, it returns a &RelRef.

pub fn raw_query(&self) -> Option<&'a str>[src]

Returns the escaped substring of the URI that contains the "query", if present.

See StrExt for details on unescaping the results.

pub fn raw_fragment(&self) -> Option<&'a str>[src]

Returns the escaped substring of the URI that contains the "fragment", if present.

See UriRawComponents::fragment for the percent-decoded version.

pub fn raw_path_segments(&self) -> impl Iterator<Item = &'a str>[src]

An iterator which returns each individual escaped path item.

See UriRawComponents::path_segments for the percent-decoded version.

pub fn raw_query_items(&self) -> impl Iterator<Item = &'a str>[src]

An iterator which returns each individual escaped query item.

See UriRawComponents::query_items for the percent-decoded version.

pub fn raw_query_key_values(&self) -> impl Iterator<Item = (&'a str, &'a str)>[src]

An iterator which returns each individual escaped query item as a key/value pair. Note that neither are unescaped.

See UriRawComponents::query_key_values for the percent-decoded version.

pub fn fragment(&self) -> Option<Cow<str>>[src]

Unescaped (percent-decoded) version of UriRawComponents::raw_fragment, using std::borrow::Cow<str> instead of &str.

pub fn host(&self) -> Option<Cow<str>>[src]

Unescaped (percent-decoded) version of UriRawComponents::raw_host, using std::borrow::Cow<str> instead of &str.

pub fn authority(&self) -> Option<Cow<str>>[src]

Unescaped (percent-decoded) version of UriRawComponents::raw_authority, using std::borrow::Cow<str> instead of &str.

pub fn userinfo(&self) -> Option<Cow<str>>[src]

Unescaped (percent-decoded) version of UriRawComponents::raw_userinfo, using std::borrow::Cow<str> instead of &str.

pub fn query(&self) -> Option<Cow<str>>[src]

Unescaped (percent-decoded) version of UriRawComponents::raw_query, using std::borrow::Cow<str> instead of &str.

pub fn path_segments(&self) -> impl Iterator<Item = Cow<str>>[src]

Unescaped (percent-decoded) version of UriRawComponents::raw_path_segments, using std::borrow::Cow<str> instead of &str.

pub fn query_items(&self) -> impl Iterator<Item = Cow<str>>[src]

Unescaped (percent-decoded) version of UriRawComponents::raw_query_items, using std::borrow::Cow<str> instead of &str.

pub fn query_key_values(&self) -> impl Iterator<Item = (Cow<str>, Cow<str>)>[src]

Unescaped (percent-decoded) version of UriRawComponents::raw_query_key_values, using std::borrow::Cow<str> instead of &str.

#[must_use] pub fn trim_leading_dot_slashes(&self) -> Self[src]

Returns a UriRawComponents with any leading dot-slashes trimmed from the path.

#[must_use] pub fn trim_query(&self) -> Self[src]

Returns a UriRawComponents with the query and fragment cleared.

#[must_use] pub fn trim_fragment(&self) -> Self[src]

Returns a UriRawComponents with the query cleared.

impl<'a> UriRawComponents<'a>[src]

pub unsafe fn from_components_unchecked(
    scheme: Option<&'a str>,
    authority: Option<&'a str>,
    path: &'a str,
    query: Option<&'a str>,
    fragment: Option<&'a str>
) -> UriRawComponents<'a>
[src]

Constructs a new UriRawComponents from the given raw, percent-encoded components, without checking that the components are valid.

This method is unsafe because the components are not checked to ensure they are valid.

Trait Implementations

impl<'_> AnyUriRef for UriRawComponents<'_>[src]

fn write_to<T: Write + ?Sized>(&self, f: &mut T) -> Result<(), Error>[src]

Note that the implementation of this method for UriRawComponents ignores the value of self.userinfo, self.host, and self.port; instead relying entirely on self.authority.

#[must_use] fn display(&self) -> UriDisplay<Self>[src]

Wraps this AnyUriRef instance in a [UriDisplay] object for use with formatting macros like write! and format!. Read more

#[must_use] fn to_uri_ref_buf(&self) -> UriRefBuf[src]

Creates a new UriRefBuf from this AnyUriRef. Read more

fn write_resolved<T: Write + ?Sized, D: AnyUriRef + ?Sized>(
    &self,
    target: &D,
    f: &mut T
) -> Result<(), ResolveError>
[src]

Writes out to a core::fmt::Write instance the result of performing URI resolution against target, with self being the base URI. Read more

#[must_use] fn resolved<T: AnyUriRef + ?Sized>(
    &self,
    dest: &T
) -> Result<UriRefBuf, ResolveError>
[src]

Creates a new UriRefBuf that contains the result of performing URI resolution with dest. Read more

impl<'a> Clone for UriRawComponents<'a>[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<'_> From<UriRawComponents<'_>> for String[src]

impl<'_, '_> From<&'_ UriRawComponents<'_>> for String[src]

impl<'a> Copy for UriRawComponents<'a>[src]

impl<'a> Eq for UriRawComponents<'a>[src]

impl<'a> PartialEq<UriRawComponents<'a>> for UriRawComponents<'a>[src]

impl<'a> Hash for UriRawComponents<'a>[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl<'_> Display for UriRawComponents<'_>[src]

impl<'a> Debug for UriRawComponents<'a>[src]

Auto Trait Implementations

impl<'a> Send for UriRawComponents<'a>

impl<'a> Unpin for UriRawComponents<'a>

impl<'a> Sync for UriRawComponents<'a>

impl<'a> UnwindSafe for UriRawComponents<'a>

impl<'a> RefUnwindSafe for UriRawComponents<'a>

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]