pub struct SocketAncillary<'a> { /* private fields */ }
Expand description
A Unix socket Ancillary data struct.
Implementations§
Source§impl<'a> SocketAncillary<'a>
impl<'a> SocketAncillary<'a>
Sourcepub fn new(buffer: &'a mut [u8]) -> Self
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[..]);
Sourcepub fn truncated(&self) -> bool
pub fn truncated(&self) -> bool
Is true
if during a recv operation the ancillary was truncated.
Sourcepub fn add_fds(&mut self, fds: &[RawFd]) -> bool
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
.
Sourcepub fn add_creds(&mut self, creds: &[SocketCred]) -> bool
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
.
Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more