[−][src]Struct http::uri::Port
The port component of a URI.
Methods
impl<T> Port<T>
[src][−]
pub fn as_u16(&self) -> u16
[src][−]
Returns the port number as a u16
.
Examples
Port as u16
.
let authority: Authority = "example.org:80".parse().unwrap(); let port = authority.port_part().unwrap(); assert_eq!(port.as_u16(), 80);
impl<T> Port<T> where
T: AsRef<str>,
[src][−]
T: AsRef<str>,
pub fn as_str(&self) -> &str
[src][−]
Returns the port number as a str
.
Examples
Port as str
.
let authority: Authority = "example.org:80".parse().unwrap(); let port = authority.port_part().unwrap(); assert_eq!(port.as_str(), "80");
Trait Implementations
impl<T, U> PartialEq<Port<U>> for Port<T>
[src][+]
impl<T> PartialEq<u16> for Port<T>
[src][+]
impl<T> PartialEq<Port<T>> for u16
[src][+]
impl<T> AsRef<str> for Port<T> where
T: AsRef<str>,
[src][+]
T: AsRef<str>,
impl<T> From<Port<T>> for u16
[src][+]
impl<T> Debug for Port<T> where
T: Debug,
[src][+]
T: Debug,
impl<T> Display for Port<T>
[src][+]
Auto Trait Implementations
Blanket Implementations
impl<T> ToString for T where
T: Display + ?Sized,
[src][−]
T: Display + ?Sized,
impl<T> From for T
[src][−]
impl<T, U> Into for T where
U: From<T>,
[src][−]
U: From<T>,
impl<T, U> TryFrom for T where
T: From<U>,
[src][−]
T: From<U>,
type Error = !
🔬 This is a nightly-only experimental API. (
try_from
)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> Borrow for T where
T: ?Sized,
[src][−]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src][−]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src][−]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src][−]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
🔬 This is a nightly-only experimental API. (
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src][−]
impl<T> Any for T where
T: 'static + ?Sized,
[src][−]
T: 'static + ?Sized,