[−][src]Struct async_coap::uri::UriRawComponents
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) -> UriRawComponents<'a>
[src]
Returns a UriRawComponents
with any leading dot-slashes trimmed from the path.
#[must_use]
pub fn trim_query(&self) -> UriRawComponents<'a>
[src]
Returns a UriRawComponents
with the query and fragment cleared.
#[must_use]
pub fn trim_fragment(&self) -> UriRawComponents<'a>
[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]
scheme: Option<&'a str>,
authority: Option<&'a str>,
path: &'a str,
query: Option<&'a str>,
fragment: Option<&'a str>
) -> UriRawComponents<'a>
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<'a> Debug for UriRawComponents<'a>
[src]
impl<'a> Hash for UriRawComponents<'a>
[src]
fn hash<__H>(&self, state: &mut __H) where
__H: Hasher,
[src]
__H: Hasher,
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<'a> Eq for UriRawComponents<'a>
[src]
impl<'_> AnyUriRef for UriRawComponents<'_>
[src]
fn write_to<T>(&self, f: &mut T) -> Result<(), Error> where
T: Write + ?Sized,
[src]
T: Write + ?Sized,
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
.
fn is_empty(&self) -> bool
[src]
fn components(&self) -> UriRawComponents
[src]
fn uri_type(&self) -> UriType
[src]
#[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, D>(
&self,
target: &D,
f: &mut T
) -> Result<(), ResolveError> where
D: AnyUriRef + ?Sized,
T: Write + ?Sized,
[src]
&self,
target: &D,
f: &mut T
) -> Result<(), ResolveError> where
D: AnyUriRef + ?Sized,
T: Write + ?Sized,
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>(&self, dest: &T) -> Result<UriRefBuf, ResolveError> where
T: AnyUriRef + ?Sized,
[src]
T: AnyUriRef + ?Sized,
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(&self) -> UriRawComponents<'a>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<'_> Display for UriRawComponents<'_>
[src]
impl<'a> Copy for UriRawComponents<'a>
[src]
impl<'a> PartialEq<UriRawComponents<'a>> for UriRawComponents<'a>
[src]
fn eq(&self, other: &UriRawComponents<'a>) -> bool
[src]
fn ne(&self, other: &UriRawComponents<'a>) -> bool
[src]
Auto Trait Implementations
impl<'a> Unpin for UriRawComponents<'a>
impl<'a> Sync for UriRawComponents<'a>
impl<'a> Send for UriRawComponents<'a>
impl<'a> UnwindSafe for UriRawComponents<'a>
impl<'a> RefUnwindSafe for UriRawComponents<'a>
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,