Struct netlink_packet_utils::nla::NlaBuffer
source · pub struct NlaBuffer<T: AsRef<[u8]>> { /* private fields */ }
Implementations§
source§impl<T: AsRef<[u8]>> NlaBuffer<T>
impl<T: AsRef<[u8]>> NlaBuffer<T>
pub fn new(buffer: T) -> NlaBuffer<T>
pub fn new_checked(buffer: T) -> Result<NlaBuffer<T>, NlaError>
pub fn check_buffer_length(&self) -> Result<(), NlaError>
sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Consume the buffer, returning the underlying buffer.
pub fn nested_flag(&self) -> bool
pub fn network_byte_order_flag(&self) -> bool
sourcepub fn length(&self) -> u16
pub fn length(&self) -> u16
Return the length
field. The length
field corresponds to the length
of the nla header (type and length fields, and the value field).
However, it does not account for the potential padding that follows
the value field.
sourcepub fn value_length(&self) -> usize
pub fn value_length(&self) -> usize
Return the length of the value
field
§Panic
This panics if the length field value is less than the attribut header size.
source§impl<T: AsRef<[u8]> + AsMut<[u8]>> NlaBuffer<T>
impl<T: AsRef<[u8]> + AsMut<[u8]>> NlaBuffer<T>
pub fn set_nested_flag(&mut self)
pub fn set_network_byte_order_flag(&mut self)
sourcepub fn set_length(&mut self, length: u16)
pub fn set_length(&mut self, length: u16)
Set the length
field
Trait Implementations§
source§impl<'buffer, T: AsRef<[u8]> + ?Sized> Parseable<NlaBuffer<&'buffer T>> for DefaultNla
impl<'buffer, T: AsRef<[u8]> + ?Sized> Parseable<NlaBuffer<&'buffer T>> for DefaultNla
type Error = DecodeError
source§impl<T: PartialEq + AsRef<[u8]>> PartialEq for NlaBuffer<T>
impl<T: PartialEq + AsRef<[u8]>> PartialEq for NlaBuffer<T>
impl<T: Copy + AsRef<[u8]>> Copy for NlaBuffer<T>
impl<T: Eq + AsRef<[u8]>> Eq for NlaBuffer<T>
impl<T: AsRef<[u8]>> StructuralPartialEq for NlaBuffer<T>
Auto Trait Implementations§
impl<T> Freeze for NlaBuffer<T>where
T: Freeze,
impl<T> RefUnwindSafe for NlaBuffer<T>where
T: RefUnwindSafe,
impl<T> Send for NlaBuffer<T>where
T: Send,
impl<T> Sync for NlaBuffer<T>where
T: Sync,
impl<T> Unpin for NlaBuffer<T>where
T: Unpin,
impl<T> UnwindSafe for NlaBuffer<T>where
T: UnwindSafe,
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)