Struct Buffer

Source
pub struct Buffer(/* private fields */);
Expand description

A buffer of bytes.

Implementations§

Source§

impl Buffer

Source

pub fn new() -> Self

Create a new general purpose byte buffer.

Source

pub fn extend_from_slice(&mut self, slice: &[u8])

Extend the given buffer with the contents of another slice.

Source

pub fn len(&self) -> usize

Get the current length of the buffer.

Source

pub fn is_empty(&self) -> bool

Check whether the buffer is empty.

Trait Implementations§

Source§

impl AsMut<[u8]> for Buffer

Source§

fn as_mut(&mut self) -> &mut [u8]

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl AsRef<[u8]> for Buffer

Source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Debug for Buffer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Buffer

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'a> From<&'a [u8]> for Buffer

Source§

fn from(slice: &'a [u8]) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<u8>> for Buffer

Source§

fn from(vec: Vec<u8>) -> Self

Converts to this type from the input type.
Source§

impl<'lifetime> FromBytesWithInput<'lifetime> for Buffer

Source§

type Input = usize

The type of the additional input.
Source§

fn from_bytes_with_input( buffer: &mut Cursor<&'lifetime [u8]>, input: Self::Input, ) -> Result<Self, DeError>

Takes a byte buffer and an additional input and returns the deserialized data structure.
Source§

impl PartialEq for Buffer

Source§

fn eq(&self, other: &Buffer) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Size for Buffer

Source§

fn unpadded_size(&self) -> usize

Size of the unpadded data structure. This will usually only be unaligned for variable length types like strings or byte buffers.
Source§

fn padded_size(&self) -> usize

Get the size of of the payload and align it to the required netlink byte alignment.
Source§

impl ToBytes for Buffer

Source§

fn to_bytes(&self, buffer: &mut Cursor<Vec<u8>>) -> Result<(), SerError>

Takes a byte buffer and serializes the data structure into it.
Source§

fn pad(&self, buffer: &mut Cursor<Vec<u8>>) -> Result<(), SerError>

Pad a netlink message to the appropriate alignment.
Source§

impl Eq for Buffer

Source§

impl StructuralPartialEq for Buffer

Auto Trait Implementations§

§

impl Freeze for Buffer

§

impl RefUnwindSafe for Buffer

§

impl Send for Buffer

§

impl Sync for Buffer

§

impl Unpin for Buffer

§

impl UnwindSafe for Buffer

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.