Skip to main content

BufferRef

Struct BufferRef 

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

Reference to a VNET buffer

A &mut BufferRef is equivalent to a vnet_buffer_opaque_t * in C (a *vnet_buffer_opaque_t in Rust).

Implementations§

Source§

impl BufferRef

Source

pub unsafe fn from_ptr<'a>(ptr: *const vnet_buffer_opaque_t) -> &'a BufferRef

Create a &BufferRef from a raw pointer

§Safety
  • The pointer must be a valid and properly initialised vlib_buffer_t.
  • The pointer must stay valid and the contents must not be mutated for the duration of the lifetime of the returned object.
Source

pub unsafe fn from_ptr_mut<'a>( ptr: *mut vnet_buffer_opaque_t, ) -> &'a mut BufferRef

Create a &mut BufferRef from a raw pointer

§Safety
  • The pointer must be a valid and properly initialised vlib_buffer_t.
  • The pointer must stay valid and the contents must not be mutated for the duration of the lifetime of the returned object.
Source

pub fn as_ptr(&self) -> *mut vnet_buffer_opaque_t

Returns the raw pointer to the underlying vnet_buffer_opaque_t

Source

pub fn feature_arc_index(&self) -> u8

Returns the index of the feature arc that the buffer is being processed from

Auto Trait Implementations§

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.