Enum AncillaryDataBuf

Source
pub enum AncillaryDataBuf<'a> {
    Borrowed(&'a mut [u8]),
    Owned(Vec<u8>),
}
Available on Unix only.
Expand description

A buffer used for receiving ancillary data from Unix domain sockets.

The actual ancillary data can be obtained using the decode method.

§Example

See UdStream or UdStreamListener for an example of receiving ancillary data.

Variants§

§

Borrowed(&'a mut [u8])

The buffer’s storage is borrowed.

§

Owned(Vec<u8>)

The buffer’s storage is owned by the buffer itself.

Implementations§

Source§

impl<'a> AncillaryDataBuf<'a>

Source

pub fn owned_with_capacity(capacity: usize) -> Self

Creates an owned ancillary data buffer with the specified capacity.

Source

pub fn decode(&'a self) -> AncillaryDataDecoder<'a>

Creates a decoder which decodes the ancillary data buffer into a friendly representation of its contents.

All invalid ancillary data blocks are skipped – if there was garbage data in the buffer to begin with, the resulting buffer will either be empty or contain invalid credentials/file descriptors. This should normally never happen if the data is actually received from a Unix domain socket.

Trait Implementations§

Source§

impl<'a> AsMut<[u8]> for AncillaryDataBuf<'a>

Source§

fn as_mut(&mut self) -> &mut [u8]

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<'a> AsRef<[u8]> for AncillaryDataBuf<'a>

Source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<'a> Debug for AncillaryDataBuf<'a>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'a> From<&'a AncillaryDataBuf<'a>> for AncillaryDataDecoder<'a>

Source§

fn from(buffer: &'a AncillaryDataBuf<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a mut [u8]> for AncillaryDataBuf<'a>

Source§

fn from(op: &'a mut [u8]) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a mut AncillaryDataBuf<'a>> for AncillaryDataBuf<'a>

Source§

fn from(op: &'a mut AncillaryDataBuf<'a>) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<u8>> for AncillaryDataBuf<'static>

Source§

fn from(op: Vec<u8>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'a> Freeze for AncillaryDataBuf<'a>

§

impl<'a> RefUnwindSafe for AncillaryDataBuf<'a>

§

impl<'a> Send for AncillaryDataBuf<'a>

§

impl<'a> Sync for AncillaryDataBuf<'a>

§

impl<'a> Unpin for AncillaryDataBuf<'a>

§

impl<'a> !UnwindSafe for AncillaryDataBuf<'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> To for T
where T: ?Sized,

Source§

fn to<T>(self) -> T
where Self: Into<T>,

Converts to T by calling Into<T>::into.
Source§

fn try_to<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Tries to convert to T by calling TryInto<T>::try_into.
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.