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

pub struct Nlattr<T, P> {
    pub nla_len: u16,
    pub nla_nested: bool,
    pub nla_network_order: bool,
    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_nested: bool

If true, the payload contains nested attributes.

nla_network_order: bool

If true, the payload is in net work byte order.

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 new_with_bitflags<P>(
    nla_len: Option<u16>,
    nla_nested: bool,
    nla_network_order: bool,
    nla_type: T,
    payload: P
) -> Result<Self, SerError> where
    P: Nl
[src]

Create a new Nlattr with parameters for setting bitflags in the header.

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<R>(&self) -> Result<AttrHandle<R>, DeError> where
    R: NlAttrType
[src]

Return an AttrHandle for attributes nested in the given attribute payload

Trait Implementations

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

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

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

impl<T, P> StructuralPartialEq for Nlattr<T, P>[src]

Auto Trait Implementations

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

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

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

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

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.