pub struct BufferImpl<'a, H: Borrow<A>, A: ?Sized + BufferAllocator> { /* private fields */ }Implementations§
Source§impl<'a, H: Borrow<A>, A: ?Sized + BufferAllocator> BufferImpl<'a, H, A>
impl<'a, H: Borrow<A>, A: ?Sized + BufferAllocator> BufferImpl<'a, H, A>
Sourcepub fn subslice<R: SliceRange>(&self, range: R) -> BufferRef<'_>
pub fn subslice<R: SliceRange>(&self, range: R) -> BufferRef<'_>
Takes a read-only reference to this buffer over range (which must be within the size of
the buffer).
Sourcepub fn as_mut(&mut self) -> MutableBufferRef<'_>
pub fn as_mut(&mut self) -> MutableBufferRef<'_>
Takes a read-write reference to this buffer.
Sourcepub fn subslice_mut<R: SliceRange>(&mut self, range: R) -> MutableBufferRef<'_>
pub fn subslice_mut<R: SliceRange>(&mut self, range: R) -> MutableBufferRef<'_>
Takes a read-write reference to this buffer over range (which must be within the size of
the buffer).
Sourcepub fn paddrs(&self) -> Option<&[zx_paddr_t]>
pub fn paddrs(&self) -> Option<&[zx_paddr_t]>
Returns the physical addresses for DMA if this buffer is pinned by its allocator.
Sourcepub fn contiguity(&self) -> Option<u64>
pub fn contiguity(&self) -> Option<u64>
Returns the contiguity used when pinning this buffer, if pinned by its allocator.
Sourcepub fn vmo(&self) -> Option<Arc<Vmo>>
pub fn vmo(&self) -> Option<Arc<Vmo>>
Returns the underlying VMO if the buffer is untrusted and backed by a VMO.
Returns None if the buffer is trusted.
Sourcepub fn try_as_slice(&self) -> Option<&[u8]>
pub fn try_as_slice(&self) -> Option<&[u8]>
Returns a reference to the underlying data if the buffer is trusted. Returns None if the buffer is untrusted (shared with the driver).
Sourcepub fn try_as_mut_slice(&mut self) -> Option<&mut [u8]>
pub fn try_as_mut_slice(&mut self) -> Option<&mut [u8]>
Returns a mutable reference to the underlying data if the buffer is trusted. Returns None if the buffer is untrusted (shared with the driver).
Sourcepub fn copy_to_slice(&self, dest: &mut [u8])
pub fn copy_to_slice(&self, dest: &mut [u8])
Sourcepub fn copy_from_slice(&mut self, src: &[u8])
pub fn copy_from_slice(&mut self, src: &[u8])
Sourcepub fn copy_from_buffer(&mut self, src: BufferRef<'_>)
pub fn copy_from_buffer(&mut self, src: BufferRef<'_>)
Sourcepub fn range(&self) -> Range<usize> ⓘ
pub fn range(&self) -> Range<usize> ⓘ
Returns the range in the underlying BufferSource that this buffer covers.
Sourcepub fn as_mut_ptr(&mut self) -> *mut u8
pub fn as_mut_ptr(&mut self) -> *mut u8
Returns a mutable raw pointer to the buffer’s contents.
Sourcepub fn as_ptr_slice(&self) -> PtrByteSlice<'_> ⓘ
pub fn as_ptr_slice(&self) -> PtrByteSlice<'_> ⓘ
Returns a read-only pointer slice over the buffer.
Sourcepub fn as_mut_ptr_slice(&mut self) -> MutPtrByteSlice<'_>
pub fn as_mut_ptr_slice(&mut self) -> MutPtrByteSlice<'_>
Returns a mutable pointer slice over the buffer.
Source§impl BufferImpl<'static, Arc<dyn BufferAllocator>, dyn BufferAllocator>
impl BufferImpl<'static, Arc<dyn BufferAllocator>, dyn BufferAllocator>
Sourcepub fn split<R>(
self,
f: impl FnOnce(&mut SplittableBuffer) -> Result<R, Error>,
on_complete: impl FnOnce(Result<OwnedBuffer, Error>) + Send + 'static,
) -> Result<R, Error>
pub fn split<R>( self, f: impl FnOnce(&mut SplittableBuffer) -> Result<R, Error>, on_complete: impl FnOnce(Result<OwnedBuffer, Error>) + Send + 'static, ) -> Result<R, Error>
Splits the buffer into one or more child OwnedBuffers via f.
When all child OwnedBuffers and SubHandles drop, the merged parent buffer is
automatically delivered to on_complete(Ok(parent_buffer)). If an error occurs via f
or during sub-operation execution, on_complete(Err(e)) is delivered.