pub struct BufferWithContext<'a> { /* private fields */ }Expand description
Owned buffer (with context)
The &MainRef context is necessary to be able to free the buffer on drop.
Implementations§
Source§impl<'a> BufferWithContext<'a>
impl<'a> BufferWithContext<'a>
Sourcepub unsafe fn from_parts(buffer: BufferIndex, vm: &'a MainRef) -> Self
pub unsafe fn from_parts(buffer: BufferIndex, vm: &'a MainRef) -> Self
Creates a BufferWithContext directly from a buffer index and a main reference
§Safety
- The buffer index must be valid and the caller must have ownership of the buffer it corresponds to.
Sourcepub fn into_parts(self) -> (BufferIndex, &'a MainRef)
pub fn into_parts(self) -> (BufferIndex, &'a MainRef)
Decomposes a BufferWithContext into its component parts
After calling this the caller is responsible for ensuring the buffer gets freed, either
by calling BufferWithContext::from_parts or by passing it into another function which
takes ownership of it and eventually causes it to be freed.
Sourcepub fn as_buffer_ref(&mut self) -> &mut BufferRef<()>
pub fn as_buffer_ref(&mut self) -> &mut BufferRef<()>
Get a mutable reference to the buffer
Trait Implementations§
Source§impl Drop for BufferWithContext<'_>
impl Drop for BufferWithContext<'_>
Auto Trait Implementations§
impl<'a> Freeze for BufferWithContext<'a>
impl<'a> !RefUnwindSafe for BufferWithContext<'a>
impl<'a> !Send for BufferWithContext<'a>
impl<'a> !Sync for BufferWithContext<'a>
impl<'a> Unpin for BufferWithContext<'a>
impl<'a> UnsafeUnpin for BufferWithContext<'a>
impl<'a> !UnwindSafe for BufferWithContext<'a>
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