[−][src]Struct neli::nlattr::Nlattr
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]
T: NlAttrType,
P: Nl,
pub fn payload_size(&self) -> usize
[src]
Get the size of the payload only
impl<T> Nlattr<T, Vec<u8>> where
T: NlAttrType,
[src]
T: NlAttrType,
pub fn new<P>(
nla_len: Option<u16>,
nla_type: T,
payload: P
) -> Result<Self, SerError> where
P: Nl,
[src]
nla_len: Option<u16>,
nla_type: T,
payload: P
) -> Result<Self, SerError> where
P: Nl,
This function will serialize the provided payload
pub fn set_payload<P>(&mut self, payload: P) -> Result<(), SerError> where
P: Nl,
[src]
P: Nl,
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]
&mut self,
attr: Nlattr<TT, P>
) -> Result<(), SerError> where
TT: NlAttrType,
P: Nl,
Add a nested attribute to the end of the payload
pub fn get_payload_as<R>(&self) -> Result<R, DeError> where
R: Nl,
[src]
R: Nl,
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]
&'a self
) -> Result<AttrHandle<'a, T>, DeError> where
R: Nl,
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]
T: NlAttrType,
P: Nl,
fn serialize(&self, mem: &mut StreamWriteBuffer) -> Result<(), SerError>
[src]
fn deserialize<B>(mem: &mut StreamReadBuffer<B>) -> Result<Self, DeError> where
B: AsRef<[u8]>,
[src]
B: AsRef<[u8]>,
fn size(&self) -> usize
[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,
P: Send,
T: Send,
impl<T, P> Sync for Nlattr<T, P> where
P: Sync,
T: Sync,
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]
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.
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,