SocketAncillary

Struct SocketAncillary 

Source
pub struct SocketAncillary<'a> { /* private fields */ }
Expand description

A Unix socket Ancillary data struct.

Implementations§

Source§

impl<'a> SocketAncillary<'a>

Source

pub fn new(buffer: &'a mut [u8]) -> Self

Create an ancillary data with the given buffer.

§Example
use posix_socket::ancillary::SocketAncillary;
let mut ancillary_buffer = [0; 128];
let mut ancillary = SocketAncillary::new(&mut ancillary_buffer[..]);
Source

pub fn capacity(&self) -> usize

Returns the capacity of the buffer.

Source

pub fn len(&self) -> usize

Returns the number of used bytes.

Source

pub fn messages(&self) -> Messages<'_>

Returns the iterator of the control messages.

Source

pub fn truncated(&self) -> bool

Is true if during a recv operation the ancillary was truncated.

Source

pub fn add_fds(&mut self, fds: &[RawFd]) -> bool

Add file descriptors to the ancillary data.

The function returns true if there was enough space in the buffer. If there was not enough space then no file descriptors was appended. Technically, that means this operation adds a control message with the level SOL_SOCKET and type SCM_RIGHTS.

Source

pub fn add_creds(&mut self, creds: &[SocketCred]) -> bool

Add credentials to the ancillary data.

The function returns true if there was enough space in the buffer. If there was not enough space then no credentials was appended. Technically, that means this operation adds a control message with the level SOL_SOCKET and type SCM_CREDENTIALS or SCM_CREDS.

Source

pub fn clear(&mut self)

Clears the ancillary data, removing all values.

Trait Implementations§

Source§

impl<'a> Debug for SocketAncillary<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for SocketAncillary<'a>

§

impl<'a> RefUnwindSafe for SocketAncillary<'a>

§

impl<'a> Send for SocketAncillary<'a>

§

impl<'a> Sync for SocketAncillary<'a>

§

impl<'a> Unpin for SocketAncillary<'a>

§

impl<'a> !UnwindSafe for SocketAncillary<'a>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.