Struct Authority
pub struct Authority { /* private fields */ }
Represents the authority component of a URI.
Implementations
impl Authority
const fn from_static(src: &'static str) -> SelfAttempt to convert an
Authorityfrom a static string.This function will not perform any copying, and the string will be checked if it is empty or contains an invalid character.
Panics
This function panics if the argument contains invalid characters or is empty.
Examples
# use Authority; let authority = from_static; assert_eq!;Attempt to convert a
Bytesbuffer to aAuthority.This will try to prevent a copy if the type passed is the type used internally, and will copy the data if it is not.
fn host(&self) -> &strGet the host of this
Authority.The host subcomponent of authority is identified by an IP literal encapsulated within square brackets, an IPv4 address in dotted- decimal form, or a registered name. The host subcomponent is case-insensitive.
abc://username:password@example.com:123/path/data?key=value&key2=value2#fragid1 |---------| | hostExamples
# use *; let authority: Authority = "example.org:80".parse.unwrap; assert_eq!;fn port(&self) -> Option<Port<&str>>Get the port part of this
Authority.The port subcomponent of authority is designated by an optional port number following the host and delimited from it by a single colon (":") character. It can be turned into a decimal port number with the
as_u16method or as astrwith theas_strmethod.abc://username:password@example.com:123/path/data?key=value&key2=value2#fragid1 |-| | portExamples
Authority with port
# use Authority; let authority: Authority = "example.org:80".parse.unwrap; let port = authority.port.unwrap; assert_eq!; assert_eq!;Authority without port
# use Authority; let authority: Authority = "example.org".parse.unwrap; assert!;fn port_u16(&self) -> Option<u16>Get the port of this
Authorityas au16.Example
# use Authority; let authority: Authority = "example.org:80".parse.unwrap; assert_eq!;fn as_str(&self) -> &strReturn a str representation of the authority
Trait Implementations
impl AsRef<str> for Authority
fn as_ref(&self) -> &str
impl Clone for Authority
fn clone(&self) -> Authority
impl Debug for Authority
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Display for Authority
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Eq for Authority
impl FromStr for Authority
type Err = InvalidUri;fn from_str(s: &str) -> Result<Self, InvalidUri>
impl Hash for Authority
fn hash<H>(&self, state: &mut H) where H: Hasher,
impl PartialEq for Authority
fn eq(&self, other: &Authority) -> bool
impl PartialEq<&str> for Authority
fn eq(&self, other: &&str) -> bool
impl PartialEq<String> for Authority
fn eq(&self, other: &String) -> bool
impl PartialEq<str> for Authority
fn eq(&self, other: &str) -> bool
impl PartialOrd for Authority
fn partial_cmp(&self, other: &Authority) -> Option<Ordering>
impl PartialOrd<&str> for Authority
fn partial_cmp(&self, other: &&str) -> Option<Ordering>
impl PartialOrd<String> for Authority
fn partial_cmp(&self, other: &String) -> Option<Ordering>
impl PartialOrd<str> for Authority
fn partial_cmp(&self, other: &str) -> Option<Ordering>
impl TryFrom<&[u8]> for Authority
type Error = InvalidUri;fn try_from(s: &[u8]) -> Result<Self, Self::Error>
impl TryFrom<&str> for Authority
type Error = InvalidUri;fn try_from(s: &str) -> Result<Self, Self::Error>
impl TryFrom<String> for Authority
type Error = InvalidUri;fn try_from(t: String) -> Result<Self, Self::Error>
impl TryFrom<Vec<u8>> for Authority
type Error = InvalidUri;fn try_from(vec: Vec<u8>) -> Result<Self, Self::Error>
Auto Trait Implementations
impl !Freeze for Authority
impl RefUnwindSafe for Authority
impl Send for Authority
impl Sync for Authority
impl Unpin for Authority
impl UnsafeUnpin for Authority
impl UnwindSafe for Authority
Blanket Implementations
impl<T> Any for Authority
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Authority
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Authority
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Authority
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for Authority
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for Authority
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T> ToString for Authority
where
T: Display + ?Sized,
fn to_string(&self) -> String
impl<T, U> Into<U> for Authority
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Authority
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Authority
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>