pub trait Attribute<T> {
fn payload(&self) -> &Buffer;
fn set_payload<P>(&mut self, payload: &P) -> Result<(), SerError>
where
P: Size + ToBytes;
fn get_payload_as<'a, R>(&'a self) -> Result<R, DeError>
where
R: FromBytes<'a>,
{ ... }
fn get_payload_as_with_len<'a, R>(&'a self) -> Result<R, DeError>
where
R: FromBytesWithInput<'a, Input = usize>,
{ ... }
}
Expand description
Trait that defines shared operations for netlink attributes. Currently, this applies to generic netlink and routing netlink attributes.
Required Methods§
sourcefn payload(&self) -> &Buffer
fn payload(&self) -> &Buffer
Get the payload of the given attribute.
Due to Rust’s requirement that all elements of a Vec
are of
the same type, payloads are represented as a byte buffer so
that nested attributes that contain multiple types for the
payload can be type checked before serialization yet still
contained all in the same top level attribute.
Provided Methods§
sourcefn get_payload_as<'a, R>(&'a self) -> Result<R, DeError>where
R: FromBytes<'a>,
fn get_payload_as<'a, R>(&'a self) -> Result<R, DeError>where
R: FromBytes<'a>,
Get an Nlattr
payload as the
provided type parameter, R
.
sourcefn get_payload_as_with_len<'a, R>(&'a self) -> Result<R, DeError>where
R: FromBytesWithInput<'a, Input = usize>,
fn get_payload_as_with_len<'a, R>(&'a self) -> Result<R, DeError>where
R: FromBytesWithInput<'a, Input = usize>,
Get an Nlattr
payload as the
provided type parameter, R
.