Struct os_socketaddr::OsSocketAddr [−][src]
Implementations
impl OsSocketAddr[src]
pub fn new() -> Self[src]
Create a new empty socket address
pub unsafe fn from_raw_parts(ptr: *const u8, len: usize) -> Self[src]
Create a new socket address from a raw slice
Panics
Panics if len is bigger that the size of libc::sockaddr_in6
pub fn from(addr: SocketAddr) -> Self[src]
Create a new socket address from a std::net::SocketAddr object
pub fn into_addr(self) -> Option<SocketAddr>[src]
Attempt to convert the internal buffer into a std::net::SocketAddr object
The internal buffer is assumed to be a libc::sockaddr.
If the value of .sa_family resolves to AF_INET or AF_INET6 then the buffer is
converted into SocketAddr, otherwise the function returns None.
pub fn len(&self) -> socklen_t[src]
Return the length of the address
The result depends on the value of .sa_family in the internal buffer:
AF_INET-> the size ofsockaddr_inAF_INET6-> the size ofsockaddr_in6- other -> 0
pub fn capacity(&self) -> socklen_t[src]
Return the size of the internal buffer
pub fn as_ptr(&self) -> *const sockaddr[src]
Get a pointer to the internal buffer
pub fn as_mut_ptr(&mut self) -> *mut sockaddr[src]
Get a mutable pointer to the internal buffer
Trait Implementations
impl AsMut<[u8]> for OsSocketAddr[src]
impl AsRef<[u8]> for OsSocketAddr[src]
fn as_ref(&self) -> &[u8][src]
Get the internal buffer as a byte slice
Note: the actual length of slice depends on the value of .sa_family (see .len())
impl Clone for OsSocketAddr[src]
fn clone(&self) -> OsSocketAddr[src]
pub fn clone_from(&mut self, source: &Self)1.0.0[src]
impl Copy for OsSocketAddr[src]
impl Debug for OsSocketAddr[src]
impl From<Option<SocketAddr>> for OsSocketAddr[src]
fn from(addr: Option<SocketAddr>) -> Self[src]
impl From<SocketAddr> for OsSocketAddr[src]
fn from(addr: SocketAddr) -> Self[src]
impl Into<Option<SocketAddr>> for OsSocketAddr[src]
fn into(self) -> Option<SocketAddr>[src]
Attempt to convert the internal buffer into a std::net::SocketAddr object
The internal buffer is assumed to be a libc::sockaddr.
If the value of .sa_family resolves to AF_INET or AF_INET6 then the buffer is
converted into SocketAddr, otherwise the function returns None.
Auto Trait Implementations
impl RefUnwindSafe for OsSocketAddr[src]
impl Send for OsSocketAddr[src]
impl Sync for OsSocketAddr[src]
impl Unpin for OsSocketAddr[src]
impl UnwindSafe for OsSocketAddr[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,