pub fn port(&self) -> Option<Port<&str>> {
        let bytes = self.as_str();
        bytes
            .rfind(":")
            .and_then(|i| Port::from_str(&bytes[i + 1..]).ok())
    }
/// 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_u16`
/// method or as a `str` with the `as_str` method.
///
/// ```notrust
/// abc://username:password@example.com:123/path/data?key=value&key2=value2#fragid1
///                                     |-|
///                                      |
///                                     port
/// ```
///
/// # Examples
///
/// Authority with port
///
/// ```
/// # use http::uri::Authority;
/// let authority: Authority = "example.org:80".parse().unwrap();
///
/// let port = authority.port().unwrap();
/// assert_eq!(port.as_u16(), 80);
/// assert_eq!(port.as_str(), "80");
/// ```
///
/// Authority without port
///
/// ```
/// # use http::uri::Authority;
/// let authority: Authority = "example.org".parse().unwrap();
///
/// assert!(authority.port().is_none());
/// ```
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.


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 .
pub fn port(&self) -> Option<Port<&str>> {
        let bytes = self.as_str();
        bytes
            .rfind(":")
            .and_then(|i| Port::from_str(&bytes[i + 1..]).ok())
    }
pub fn port ( & self ) -> Option < Port < & str > > { let bytes = self . as_str ( ) ; bytes . rfind ( " " ) . and_then ( | i | Port :: from_str ( & bytes [ i + 1 .. ] ) . ok ( ) ) }
Get the port part of this `Authority`.
Get the port part of this ` Authority ` .
&self
&self
examples
Authority with port


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



Authority without port


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


let authority : Authority = " example . org " . parse () . unwrap () .