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
impl BufferRef
Sourcepub unsafe fn from_ptr<'a>(ptr: *const vnet_buffer_opaque_t) -> &'a BufferRef
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.
Sourcepub unsafe fn from_ptr_mut<'a>(
ptr: *mut vnet_buffer_opaque_t,
) -> &'a mut BufferRef
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.
Sourcepub fn as_ptr(&self) -> *mut vnet_buffer_opaque_t
pub fn as_ptr(&self) -> *mut vnet_buffer_opaque_t
Returns the raw pointer to the underlying vnet_buffer_opaque_t
Sourcepub fn feature_arc_index(&self) -> u8
pub fn feature_arc_index(&self) -> u8
Returns the index of the feature arc that the buffer is being processed from
Sourcepub fn rx_sw_if_index(&self) -> SwIfIndex
pub fn rx_sw_if_index(&self) -> SwIfIndex
Returns the index of the receive software interface
Sourcepub fn set_rx_sw_if_index(&mut self, sw_if_index: SwIfIndex)
pub fn set_rx_sw_if_index(&mut self, sw_if_index: SwIfIndex)
Set the index of the receive software interface
Sourcepub fn tx_sw_if_index(&self) -> Option<SwIfIndex>
pub fn tx_sw_if_index(&self) -> Option<SwIfIndex>
Returns the index of the transmit software interface
Sourcepub fn set_tx_sw_if_index(&mut self, sw_if_index: Option<SwIfIndex>)
pub fn set_tx_sw_if_index(&mut self, sw_if_index: Option<SwIfIndex>)
Set the index of the transmit software interface
If sw_if_index is None then it will be set to u32::MAX, which indicates to
various nodes to use the interface from forwarding lookups.
Auto Trait Implementations§
impl Freeze for BufferRef
impl !RefUnwindSafe for BufferRef
impl !Send for BufferRef
impl !Sync for BufferRef
impl Unpin for BufferRef
impl UnsafeUnpin for BufferRef
impl UnwindSafe for BufferRef
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