Struct socket2::SockAddr [−][src]
pub struct SockAddr { /* fields omitted */ }
The address of a socket.
SockAddr
s may be constructed directly to and from the standard library
SocketAddr
, SocketAddrV4
, and SocketAddrV6
types.
Methods
impl SockAddr
[src]
impl SockAddr
pub unsafe fn from_raw_parts(addr: *const sockaddr, len: socklen_t) -> SockAddr
[src]
pub unsafe fn from_raw_parts(addr: *const sockaddr, len: socklen_t) -> SockAddr
Constructs a SockAddr
from its raw components.
pub fn as_inet(&self) -> Option<SocketAddrV4>
[src]
pub fn as_inet(&self) -> Option<SocketAddrV4>
Returns this address as a SocketAddrV4
if it is in the AF_INET
family.
pub fn as_inet6(&self) -> Option<SocketAddrV6>
[src]
pub fn as_inet6(&self) -> Option<SocketAddrV6>
Returns this address as a SocketAddrV4
if it is in the AF_INET6
family.
pub fn family(&self) -> sa_family_t
[src]
pub fn family(&self) -> sa_family_t
Returns this address's family.
pub fn len(&self) -> socklen_t
[src]
pub fn len(&self) -> socklen_t
Returns the size of this address in bytes.
pub fn as_ptr(&self) -> *const sockaddr
[src]
pub fn as_ptr(&self) -> *const sockaddr
Returns a raw pointer to the address.
Trait Implementations
impl Debug for SockAddr
[src]
impl Debug for SockAddr
fn fmt(&self, fmt: &mut Formatter) -> Result
[src]
fn fmt(&self, fmt: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl From<SocketAddrV4> for SockAddr
[src]
impl From<SocketAddrV4> for SockAddr
fn from(addr: SocketAddrV4) -> SockAddr
[src]
fn from(addr: SocketAddrV4) -> SockAddr
Performs the conversion.
impl From<SocketAddrV6> for SockAddr
[src]
impl From<SocketAddrV6> for SockAddr
fn from(addr: SocketAddrV6) -> SockAddr
[src]
fn from(addr: SocketAddrV6) -> SockAddr
Performs the conversion.
impl From<SocketAddr> for SockAddr
[src]
impl From<SocketAddr> for SockAddr
fn from(addr: SocketAddr) -> SockAddr
[src]
fn from(addr: SocketAddr) -> SockAddr
Performs the conversion.