pub enum AncillaryDataBuf<'a> {
Borrowed(&'a mut [u8]),
Owned(Vec<u8>),
}
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>
impl<'a> AncillaryDataBuf<'a>
Sourcepub fn owned_with_capacity(capacity: usize) -> Self
pub fn owned_with_capacity(capacity: usize) -> Self
Creates an owned ancillary data buffer with the specified capacity.
Sourcepub fn decode(&'a self) -> AncillaryDataDecoder<'a> ⓘ
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.