pub struct Attribute {
pub identifier: u16,
/* private fields */
}Expand description
Netlink attribute
| length | identifier | data | padding |
|--------|------------|--------------------|---------|
| u16 | u16 | u8 * (length - 4) | |The data is 4 byte aligned.
Fields§
§identifier: u16Attribute identifier
Implementations§
Source§impl Attribute
impl Attribute
Sourcepub fn unpack_all(data: &[u8]) -> (usize, Vec<Attribute>)
pub fn unpack_all(data: &[u8]) -> (usize, Vec<Attribute>)
Unpack all attributes in the byte slice
Sourcepub fn new_bytes<ID: Into<u16>>(identifier: ID, value: &[u8]) -> Attribute
pub fn new_bytes<ID: Into<u16>>(identifier: ID, value: &[u8]) -> Attribute
Create a new string attribute with provided identifier
Sourcepub fn new_string_with_nul<ID: Into<u16>>(
identifier: ID,
value: &str,
) -> Attribute
pub fn new_string_with_nul<ID: Into<u16>>( identifier: ID, value: &str, ) -> Attribute
Create a new string attribute with provided identifier
Sourcepub fn new_string<ID: Into<u16>>(identifier: ID, value: &str) -> Attribute
pub fn new_string<ID: Into<u16>>(identifier: ID, value: &str) -> Attribute
Create a new string attribute with provided identifier
Sourcepub fn new<ID: Into<u16>, V: NativePack>(identifier: ID, value: V) -> Attribute
pub fn new<ID: Into<u16>, V: NativePack>(identifier: ID, value: V) -> Attribute
Create a new attribute from a type that can be packed into a byte slice
Sourcepub fn as_hardware_address(&self) -> Result<HardwareAddress>
pub fn as_hardware_address(&self) -> Result<HardwareAddress>
Unpack the underlying data into a HardwareAddress
Trait Implementations§
Source§impl NativePack for Attribute
impl NativePack for Attribute
Source§impl NativeUnpack for Attribute
impl NativeUnpack for Attribute
Auto Trait Implementations§
impl Freeze for Attribute
impl RefUnwindSafe for Attribute
impl Send for Attribute
impl Sync for Attribute
impl Unpin for Attribute
impl UnwindSafe for Attribute
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more