Struct Port

struct Port<T> { ... }

The port component of a URI.

Implementations

impl<T> Port<T>

fn as_str(self: &Self) -> &str

Returns the port number as a str.

Examples

Port as str.

# use http::uri::Authority;
let authority: Authority = "example.org:80".parse().unwrap();

let port = authority.port().unwrap();
assert_eq!(port.as_str(), "80");

impl<T> Port<T>

const fn as_u16(self: &Self) -> u16

Returns the port number as a u16.

Examples

Port as u16.

# use http::uri::Authority;
let authority: Authority = "example.org:80".parse().unwrap();

let port = authority.port().unwrap();
assert_eq!(port.as_u16(), 80);

impl<T> Any for Port<T>

fn type_id(self: &Self) -> TypeId

impl<T> AsRef for Port<T>

fn as_ref(self: &Self) -> &str

impl<T> Borrow for Port<T>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Port<T>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> Debug for Port<T>

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl<T> Display for Port<T>

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl<T> Freeze for Port<T>

impl<T> From for Port<T>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> PartialEq for Port<T>

fn eq(self: &Self, other: &u16) -> bool

impl<T> RefUnwindSafe for Port<T>

impl<T> Send for Port<T>

impl<T> Sync for Port<T>

impl<T> ToString for Port<T>

fn to_string(self: &Self) -> String

impl<T> Unpin for Port<T>

impl<T> UnsafeUnpin for Port<T>

impl<T> UnwindSafe for Port<T>

impl<T, U> Into for Port<T>

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> PartialEq for Port<T>

fn eq(self: &Self, other: &Port<U>) -> bool

impl<T, U> TryFrom for Port<T>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for Port<T>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>