Struct rustix::net::RecvAncillaryBuffer
source · pub struct RecvAncillaryBuffer<'buf> { /* private fields */ }
Expand description
Implementations§
source§impl<'buf> RecvAncillaryBuffer<'buf>
impl<'buf> RecvAncillaryBuffer<'buf>
sourcepub fn new(buffer: &'buf mut [u8]) -> Self
pub fn new(buffer: &'buf mut [u8]) -> Self
Create a new, empty RecvAncillaryBuffer
from a raw byte buffer.
The buffer size may be computed with cmsg_space
, or it may be
zero for an empty buffer, however in that case, consider default()
instead, or even using recv
instead of recvmsg
.
Examples
Allocate a buffer for a single file descriptor:
let mut space = [0; rustix::cmsg_space!(ScmRights(1))];
let mut cmsg_buffer = RecvAncillaryBuffer::new(&mut space);
Allocate a buffer for credentials:
let mut space = [0; rustix::cmsg_space!(ScmCredentials(1))];
let mut cmsg_buffer = RecvAncillaryBuffer::new(&mut space);
Allocate a buffer for two file descriptors and credentials:
let mut space = [0; rustix::cmsg_space!(ScmRights(2), ScmCredentials(1))];
let mut cmsg_buffer = RecvAncillaryBuffer::new(&mut space);
sourcepub fn drain(&mut self) -> AncillaryDrain<'_> ⓘ
pub fn drain(&mut self) -> AncillaryDrain<'_> ⓘ
Drain all messages from the buffer.
Trait Implementations§
source§impl<'buf> Default for RecvAncillaryBuffer<'buf>
impl<'buf> Default for RecvAncillaryBuffer<'buf>
source§fn default() -> RecvAncillaryBuffer<'buf>
fn default() -> RecvAncillaryBuffer<'buf>
Returns the “default value” for a type. Read more
source§impl Drop for RecvAncillaryBuffer<'_>
impl Drop for RecvAncillaryBuffer<'_>
Auto Trait Implementations§
impl<'buf> RefUnwindSafe for RecvAncillaryBuffer<'buf>
impl<'buf> Send for RecvAncillaryBuffer<'buf>
impl<'buf> Sync for RecvAncillaryBuffer<'buf>
impl<'buf> Unpin for RecvAncillaryBuffer<'buf>
impl<'buf> !UnwindSafe for RecvAncillaryBuffer<'buf>
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