[−][src]Struct neli::nlattr::Nlattr
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]
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 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]
nla_len: Option<u16>,
nla_nested: bool,
nla_network_order: bool,
nla_type: T,
payload: P
) -> Result<Self, SerError> where
P: Nl,
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]
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<R>(&self) -> Result<AttrHandle<R>, DeError> where
R: NlAttrType,
[src]
R: NlAttrType,
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]
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]
fn pad(&self, m: &mut StreamWriteBuffer) -> Result<(), SerError>
[src]
fn strip<T>(&self, m: &mut StreamReadBuffer<T>) -> Result<(), DeError> where
T: AsRef<[u8]>,
[src]
T: AsRef<[u8]>,
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,
P: RefUnwindSafe,
T: RefUnwindSafe,
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,
impl<T, P> Unpin for Nlattr<T, P> where
P: Unpin,
T: Unpin,
P: Unpin,
T: Unpin,
impl<T, P> UnwindSafe for Nlattr<T, P> where
P: UnwindSafe,
T: UnwindSafe,
P: UnwindSafe,
T: UnwindSafe,
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,
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.
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>,