Struct Domain

pub struct Domain(/* private field */);

Specification of the communication domain for a socket.

This is a newtype wrapper around an integer which provides a nicer API in addition to an injection point for documentation. Convenience constants such as Domain::IPV4, Domain::IPV6, etc, are provided to avoid reaching into libc for various constants.

This type is freely interconvertible with C's int type, however, if a raw value needs to be provided.

Implementations

impl Domain

const IPV4: Domain = _;

Domain for IPv4 communication, corresponding to AF_INET.

const IPV6: Domain = _;

Domain for IPv6 communication, corresponding to AF_INET6.

const UNIX: Domain = _;

Domain for Unix socket communication, corresponding to AF_UNIX.

const fn for_address(address: SocketAddr) -> Domain

Returns the correct domain for address.

impl Domain

const PACKET: Domain = _;

Domain for low-level packet interface, corresponding to AF_PACKET.

const VSOCK: Domain = _;

Domain for low-level VSOCK interface, corresponding to AF_VSOCK.

Trait Implementations

impl Clone for Domain

fn clone(&self) -> Self

impl Copy for Domain

impl Debug for Domain

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

impl Eq for Domain

impl From<i32> for Domain

fn from(d: c_int) -> Domain

impl PartialEq for Domain

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

impl StructuralPartialEq for Domain

Auto Trait Implementations

impl Freeze for Domain

impl RefUnwindSafe for Domain

impl Send for Domain

impl Sync for Domain

impl Unpin for Domain

impl UnsafeUnpin for Domain

impl UnwindSafe for Domain

Blanket Implementations

impl<T> Any for Domain where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for Domain where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for Domain where T: ?Sized,

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

impl<T> CloneToUninit for Domain where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for Domain

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for Domain where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T, U> Into<U> for Domain where U: From<T>,

fn into(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> TryFrom<U> for Domain where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for Domain where U: TryFrom<T>,

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