Trait neli::attr::Attribute

source ·
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§

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.

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

This method serializes the payload parameter and stores the resulting byte buffer as the payload.

Provided Methods§

Get an Nlattr payload as the provided type parameter, R.

Get an Nlattr payload as the provided type parameter, R.

Implementors§