[−][src]Enum async_coap::uri::UriType
Enum describing the type of a URI.
Variants
Uri
An IETF-RFC3986 "URI", including both scheme and authority components;
E.g. http://example.com/abcd
assert_eq!(UriType::Uri, uri_ref!("http://example.com/abcd").uri_type());
URI references with this type can borrowed as a &Uri
.
UriNoAuthority
An IETF-RFC3986 "URI" that has a scheme but no authority component, where
the path begins with a slash;
E.g. unix:/run/foo.socket
assert_eq!(UriType::UriNoAuthority, uri_ref!("unix:/run/foo.socket").uri_type());
URI references with this type can borrowed as a &Uri
.
UriCannotBeABase
An IETF-RFC3986 "URI" that has a scheme but no authority component, where
the path does not start with a slash (/
);
E.g. tel:+1-555-867-5309
assert_eq!(UriType::UriCannotBeABase, uri_ref!("tel:+1-555-867-5309").uri_type());
URI references with this type can borrowed as a &Uri
.
NetworkPath
An IETF-RFC3986 "network-path" that has an authority component but no scheme;
E.g. //example.com/foo/bar?q
assert_eq!(UriType::NetworkPath, uri_ref!("//example.com/foo/bar").uri_type());
Note that according to IETF-RFC3986 this is a "relative-reference", but because it
includes an authority this library considers it to be borrowable as a &Uri
.
AbsolutePath
An IETF-RFC3986 "relative-reference" with a "path-absolute" and optionally a query and/or fragment;
E.g. /foo/bar?q
assert_eq!(UriType::AbsolutePath, uri_ref!("/foo/bar?q").uri_type());
URI references with this type can borrowed as a &RelRef
.
RelativePath
An IETF-RFC3986 "relative-reference" with a "path-rootless" and optionally a query and/or fragment;
E.g. foo/bar?q
An empty URI reference has this type, but the path is guaranteed to have a non-zero length if a query or fragment is present.
assert_eq!(UriType::RelativePath, uri_ref!("foo/bar?q").uri_type()); assert_eq!(UriType::RelativePath, uri_ref!("").uri_type());
URI references with this type can borrowed as a &RelRef
.
Query
An IETF-RFC3986 "relative-reference" with a "path-empty", a query, and optionally a fragment;
E.g. ?q=blah
, ?q=blah#foo-bar
assert_eq!(UriType::Query, uri_ref!("?q=blah").uri_type()); assert_eq!(UriType::Query, uri_ref!("?q=blah#foo-bar").uri_type());
URI references with this type can borrowed as a &RelRef
.
Fragment
An IETF-RFC3986 "relative-reference" that includes only a fragment component;
E.g. #foo-bar
assert_eq!(UriType::Fragment, uri_ref!("#foo-bar").uri_type());
URI references with this type can borrowed as a &RelRef
.
Methods
impl UriType
[src]
pub fn can_borrow_as_uri(&self) -> bool
[src]
Returns true if this type can be borrowed as a [&Uri
], false otherwise.
pub fn can_borrow_as_rel_ref(&self) -> bool
[src]
Returns true if this type can be borrowed as a [&RelRef
], false otherwise.
pub fn has_absolute_path(&self) -> bool
[src]
Returns true if this type can be assumed to have an absolute path.
pub fn is_ietf_rfc3986_relative_reference(&self) -> bool
[src]
Returns true if IETF-RFC3986 considers this type to be a "relative-reference".
pub fn cannot_be_a_base(&self) -> bool
[src]
Returns true if this type cannot be used as a base when performing URI reference resolution.
Trait Implementations
impl Debug for UriType
[src]
impl Hash for UriType
[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 Eq for UriType
[src]
impl Clone for UriType
[src]
fn clone(&self) -> UriType
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Copy for UriType
[src]
impl PartialEq<UriType> for UriType
[src]
Auto Trait Implementations
impl Send for UriType
impl Unpin for UriType
impl Sync for UriType
impl UnwindSafe for UriType
impl RefUnwindSafe for UriType
Blanket Implementations
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> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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>,