[−][src]Struct uapi::NlmsgWriter
beta features are subject to change at any time
A writer for netlink messages
See also the crate documentation.
Implementations
impl<'a, H: NlmsgHeader> NlmsgWriter<'a, H>
[src]
pub fn new<T: Pod + ?Sized>(buf: &'a mut T, header: H) -> Result<Self>
[src]
Creates a new writer that uses the buffer as backing storage
pub fn write<T: ?Sized>(&mut self, data: &T) -> Result<()>
[src]
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.
pub fn nest<H2: NlmsgHeader>(
&mut self,
header: H2
) -> Result<NlmsgWriter<'_, H2>>
[src]
&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
.
pub fn finalize(self) -> Result<&'a mut [u8]>
[src]
Sets the length field of the header to the correct value
This function returns an error if [NlmsgHeader::set_len]
fails.
Trait Implementations
impl<'a, H: NlmsgHeader> Drop for NlmsgWriter<'a, H>
[src]
Auto Trait Implementations
impl<'a, H> RefUnwindSafe for NlmsgWriter<'a, H> where
H: RefUnwindSafe,
[src]
H: RefUnwindSafe,
impl<'a, H> Send for NlmsgWriter<'a, H> where
H: Send,
[src]
H: Send,
impl<'a, H> Sync for NlmsgWriter<'a, H> where
H: Sync,
[src]
H: Sync,
impl<'a, H> Unpin for NlmsgWriter<'a, H> where
H: Unpin,
[src]
H: Unpin,
impl<'a, H = ()> !UnwindSafe for NlmsgWriter<'a, H>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,