[−][src]Struct http::uri::Port
The port component of a URI.
Methods
impl<T> Port<T>
[src]
impl<T> Port<T>
pub fn as_u16(&self) -> u16
[src]
pub fn as_u16(&self) -> u16
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]
impl<T> Port<T> where
T: AsRef<str>,
pub fn as_str(&self) -> &str
[src]
pub fn as_str(&self) -> &str
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> From<Port<T>> for u16
[src]
impl<T> From<Port<T>> for u16
impl<T> AsRef<str> for Port<T> where
T: AsRef<str>,
[src]
impl<T> AsRef<str> for Port<T> where
T: AsRef<str>,
impl<T, U> PartialEq<Port<U>> for Port<T>
[src]
impl<T, U> PartialEq<Port<U>> for Port<T>
fn eq(&self, other: &Port<U>) -> bool
[src]
fn eq(&self, other: &Port<U>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl<T> PartialEq<u16> for Port<T>
[src]
impl<T> PartialEq<u16> for Port<T>
fn eq(&self, other: &u16) -> bool
[src]
fn eq(&self, other: &u16) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl<T> PartialEq<Port<T>> for u16
[src]
impl<T> PartialEq<Port<T>> for u16
fn eq(&self, other: &Port<T>) -> bool
[src]
fn eq(&self, other: &Port<T>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl<T> Display for Port<T>
[src]
impl<T> Display for Port<T>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<T> Debug for Port<T> where
T: Debug,
[src]
impl<T> Debug for Port<T> where
T: Debug,
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
impl<T> ToString for T where
T: Display + ?Sized,
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
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]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more