Struct Type

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

Specification of communication semantics on 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 Type::STREAM, Type::DGRAM, 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 Type

const STREAM: Type = _;

Type corresponding to SOCK_STREAM.

Used for protocols such as TCP.

const DGRAM: Type = _;

Type corresponding to SOCK_DGRAM.

Used for protocols such as UDP.

const DCCP: Type = _;

Type corresponding to SOCK_DCCP.

Used for the DCCP protocol.

const SEQPACKET: Type = _;

Type corresponding to SOCK_SEQPACKET.

const RAW: Type = _;

Type corresponding to SOCK_RAW.

impl Type

const fn nonblocking(self) -> Type

Set SOCK_NONBLOCK on the Type.

const fn cloexec(self) -> Type

Set SOCK_CLOEXEC on the Type.

Trait Implementations

impl Clone for Type

fn clone(&self) -> Self

impl Copy for Type

impl Debug for Type

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

impl Eq for Type

impl From<i32> for Type

fn from(t: c_int) -> Type

impl PartialEq for Type

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

impl StructuralPartialEq for Type

Auto Trait Implementations

impl Freeze for Type

impl RefUnwindSafe for Type

impl Send for Type

impl Sync for Type

impl Unpin for Type

impl UnsafeUnpin for Type

impl UnwindSafe for Type

Blanket Implementations

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

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

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

impl<T> From<T> for Type

fn from(t: T) -> T

Returns the argument unchanged.

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

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

impl<T, U> Into<U> for Type 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 Type where U: Into<T>,

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

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

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