[][src]Struct inet2_addr::InetSocketAddr

pub struct InetSocketAddr {
    pub address: InetAddr,
    pub port: u16,
}

Internet socket address, which consists of InetAddr IP or Tor address and a port number (without protocol specification, i.e. TCP/UDP etc). If you need to include transport-level protocol information into the socket details, pls check InetSocketAddrExt

Fields

address: InetAddr

Address part of the socket

port: u16

Port of the socket

Implementations

impl InetSocketAddr[src]

pub fn new(address: InetAddr, port: u16) -> Self[src]

Constructs new socket address from an internet address and a port information

pub fn is_tor(&self) -> bool[src]

Determines whether provided address is a Tor address

impl InetSocketAddr[src]

pub const UNIFORM_ADDR_LEN: usize[src]

Length of the encoded address; equal to the maximal length of encoding for different address types

pub fn from_uniform_encoding(data: &[u8]) -> Option<Self>[src]

Decodes byte array containing uniform encoding of some socket address, constructed with [to_uniform_encoding()]. If the address can't be recognized, returns Option::None

pub fn to_uniform_encoding(&self) -> [u8; 35][src]

Encodes address into a uniform byte array for storage. Here, uniform means that it can contain any possible internet address and have some fixed length (equal to InetSocketAddr::UNIFORM_ADDR_LEN)

Trait Implementations

impl Clone for InetSocketAddr[src]

impl Copy for InetSocketAddr[src]

impl Debug for InetSocketAddr[src]

impl Default for InetSocketAddr[src]

impl Display for InetSocketAddr[src]

impl Eq for InetSocketAddr[src]

impl From<SocketAddr> for InetSocketAddr[src]

impl From<SocketAddrV4> for InetSocketAddr[src]

impl From<SocketAddrV6> for InetSocketAddr[src]

impl FromStr for InetSocketAddr[src]

type Err = AddrParseError

The associated error which can be returned from parsing.

impl Hash for InetSocketAddr[src]

impl Ord for InetSocketAddr[src]

impl PartialEq<InetSocketAddr> for InetSocketAddr[src]

impl PartialOrd<InetSocketAddr> for InetSocketAddr[src]

impl StructuralEq for InetSocketAddr[src]

impl StructuralPartialEq for InetSocketAddr[src]

impl TryFrom<&'_ str> for InetSocketAddr[src]

type Error = <InetSocketAddr as FromStr>::Err

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.