Struct uapi::NlmsgWriter
source · pub struct NlmsgWriter<'a, H: NlmsgHeader = ()> { /* private fields */ }
👎Deprecated: beta features are subject to change at any time
Expand description
A writer for netlink messages
See also the crate documentation.
Implementations§
source§impl<'a, H: NlmsgHeader> NlmsgWriter<'a, H>
impl<'a, H: NlmsgHeader> NlmsgWriter<'a, H>
sourcepub fn new<T: Pod + ?Sized>(buf: &'a mut T, header: H) -> Result<Self>
pub fn new<T: Pod + ?Sized>(buf: &'a mut T, header: H) -> Result<Self>
Creates a new writer that uses the buffer as backing storage
sourcepub fn write<T: ?Sized>(&mut self, data: &T) -> Result<()>
pub fn write<T: ?Sized>(&mut self, data: &T) -> Result<()>
Writes an object to the buffer
This involves three steps:
- The write position is aligned to the next 4 byte boundary
- The object is written
- The write position is advanced by the size of the object
Returns an error if the buffer does not contain enough space.
sourcepub fn nest<H2: NlmsgHeader>(
&mut self,
header: H2
) -> Result<NlmsgWriter<'_, H2>>
pub fn nest<H2: NlmsgHeader>( &mut self, header: H2 ) -> Result<NlmsgWriter<'_, H2>>
Nests a new message within the write buffer
Returns an error if there is not enough space to write the header at the next 4 byte boundary.
When the nested writer is dropped, the behavior is as if the nested message
had been written to a separate buffer and then written to this writer using
Self::write
.
Trait Implementations§
source§impl<'a, H: NlmsgHeader> Drop for NlmsgWriter<'a, H>
impl<'a, H: NlmsgHeader> Drop for NlmsgWriter<'a, H>
Auto Trait Implementations§
impl<'a, H> Freeze for NlmsgWriter<'a, H>where
H: Freeze,
impl<'a, H> RefUnwindSafe for NlmsgWriter<'a, H>where
H: RefUnwindSafe,
impl<'a, H> Send for NlmsgWriter<'a, H>where
H: Send,
impl<'a, H> Sync for NlmsgWriter<'a, H>where
H: Sync,
impl<'a, H> Unpin for NlmsgWriter<'a, H>where
H: Unpin,
impl<'a, H = ()> !UnwindSafe for NlmsgWriter<'a, H>
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