[][src]Struct uapi::NlmsgWriter

pub struct NlmsgWriter<'a, H: NlmsgHeader = ()> { /* fields omitted */ }
👎 Deprecated:

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]

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]

impl<'a, H> Send for NlmsgWriter<'a, H> where
    H: Send
[src]

impl<'a, H> Sync for NlmsgWriter<'a, H> where
    H: Sync
[src]

impl<'a, H> Unpin for NlmsgWriter<'a, H> where
    H: Unpin
[src]

impl<'a, H = ()> !UnwindSafe for NlmsgWriter<'a, H>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.