pub struct FrameRef<N: Node + ?Sized>(/* private fields */);Expand description
Reference to a VPP node frame
A &mut FrameRef corresponds to vlib_frame_t * in C.
Implementations§
Source§impl<N: Node + ?Sized> FrameRef<N>
impl<N: Node + ?Sized> FrameRef<N>
Sourcepub unsafe fn from_ptr_mut<'a>(ptr: *mut vlib_frame_t) -> &'a mut Self
pub unsafe fn from_ptr_mut<'a>(ptr: *mut vlib_frame_t) -> &'a mut Self
Creates a &mut FrameRef directly from a pointer
§Safety
- The pointer must be valid and a properly initialised
vlib_frame_t. - The pointer must stay valid and the contents must not be mutated for the duration of the lifetime of the returned object.
scalar_offset,vector_offset, andaux_offsetmust be set correctly to point to the valid, initialised data areas in the frame, andn_vectorsmust be set correctly to indicate the number of valid vector and aux elements.
Sourcepub fn as_ptr(&self) -> *mut vlib_frame_t
pub fn as_ptr(&self) -> *mut vlib_frame_t
Returns the raw pointer to the underlying vlib_frame_t
Source§impl<N, V> FrameRef<N>
impl<N, V> FrameRef<N>
Sourcepub unsafe fn get_buffers<'me, 'vm, 'buf: 'vm + 'me, const ARRAY_N: usize>(
&'me self,
vm: &'vm MainRef,
to: &mut ArrayVec<&'buf mut BufferRef<N::FeatureData>, ARRAY_N>,
) -> &'me [N::Vector]
pub unsafe fn get_buffers<'me, 'vm, 'buf: 'vm + 'me, const ARRAY_N: usize>( &'me self, vm: &'vm MainRef, to: &mut ArrayVec<&'buf mut BufferRef<N::FeatureData>, ARRAY_N>, ) -> &'me [N::Vector]
Get pointers to buffers for the given buffer indices, writing them into the provided to arrayvec.
This is similar to vlib_get_buffers in the C API.
Note that although it would be more idiomatic to return an ArrayVec directly, this
method takes a mutable reference to an ArrayVec to avoid an unnecessary copy when
returning.
§Safety
- The caller must ensure that
tohas enough capacity to hold all the buffers corresponding to the indices infrom_indices. - Each buffer’s
feature_arc_indexandcurrent_config_indexmust be consistent with theFeatureDatatype. If they are not known (i.e. because the caller the node isn’t being executed in a feature arc), FeatureData should be a zero-sized type such as(). - Must not be called more than once without the framing being flushed in between as Rust’s reference aliasing rules will be violated.
Auto Trait Implementations§
impl<N> Freeze for FrameRef<N>where
N: ?Sized,
impl<N> !RefUnwindSafe for FrameRef<N>
impl<N> !Send for FrameRef<N>
impl<N> !Sync for FrameRef<N>
impl<N> Unpin for FrameRef<N>
impl<N> UnsafeUnpin for FrameRef<N>where
N: ?Sized,
impl<N> UnwindSafe for FrameRef<N>where
N: UnwindSafe + ?Sized,
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