[][src]Struct neli::nlattr::Nlattr

pub struct Nlattr<T, P> {
    pub nla_len: u16,
    pub nla_type: T,
    pub payload: P,
}

Struct representing netlink attributes and payloads

Fields

nla_len: u16

Length of the attribute header and payload together

nla_type: T

Enum representing the type of the attribute payload

payload: P

Payload of the attribute - either parsed or a binary buffer

Methods

impl<T, P> Nlattr<T, P> where
    T: NlAttrType,
    P: Nl
[src]

pub fn payload_size(&self) -> usize[src]

Get the size of the payload only

impl<T> Nlattr<T, Vec<u8>> where
    T: NlAttrType
[src]

pub fn new<P>(
    nla_len: Option<u16>,
    nla_type: T,
    payload: P
) -> Result<Self, SerError> where
    P: Nl
[src]

This function will serialize the provided payload

pub fn set_payload<P>(&mut self, payload: P) -> Result<(), SerError> where
    P: Nl
[src]

Set the payload to a data type that implements Nl - this function will overwrite the current payload

pub fn add_nested_attribute<TT, P>(
    &mut self,
    attr: Nlattr<TT, P>
) -> Result<(), SerError> where
    TT: NlAttrType,
    P: Nl
[src]

Add a nested attribute to the end of the payload

pub fn get_payload_as<R>(&self) -> Result<R, DeError> where
    R: Nl
[src]

Get an Nlattr payload as a provided type

pub fn get_nested_attributes<'a, R>(
    &'a self
) -> Result<AttrHandle<'a, T>, DeError> where
    R: Nl
[src]

Return an AttrHandle for attributes nested in the given attribute payload

Trait Implementations

impl<T, P> Nl for Nlattr<T, P> where
    T: NlAttrType,
    P: Nl
[src]

fn asize(&self) -> usize[src]

The size of the binary representation of a struct - aligned to word size

impl<T: PartialEq, P: PartialEq> PartialEq<Nlattr<T, P>> for Nlattr<T, P>[src]

impl<T: Debug, P: Debug> Debug for Nlattr<T, P>[src]

Auto Trait Implementations

impl<T, P> Send for Nlattr<T, P> where
    P: Send,
    T: Send

impl<T, P> Sync for Nlattr<T, P> where
    P: Sync,
    T: Sync

Blanket Implementations

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.

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

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

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