pub struct Allocation<LT: Lifetime> { /* private fields */ }
Expand description
An allocation of the Allocator
.
Implementations§
Source§impl<LT: Lifetime> Allocation<LT>
impl<LT: Lifetime> Allocation<LT>
Sourcepub fn device_memory(&self) -> DeviceMemory
pub fn device_memory(&self) -> DeviceMemory
The DeviceMemory
of the allocation. Managed by the allocator.
Sourcepub fn offset(&self) -> DeviceSize
pub fn offset(&self) -> DeviceSize
The offset inside the DeviceMemory
.
Sourcepub fn size(&self) -> DeviceSize
pub fn size(&self) -> DeviceSize
The size of the allocation.
Sourcepub unsafe fn mapped_slice(&self) -> Result<Option<&[u8]>, AllocatorError>
pub unsafe fn mapped_slice(&self) -> Result<Option<&[u8]>, AllocatorError>
Returns a valid mapped slice if the memory is host visible, otherwise it will return None. The slice already references the exact memory region of the sub allocation, so no offset needs to be applied.
§Safety
Caller needs to make sure that the allocation is still valid and coherent.
Sourcepub unsafe fn mapped_slice_mut(
&mut self,
) -> Result<Option<&mut [u8]>, AllocatorError>
pub unsafe fn mapped_slice_mut( &mut self, ) -> Result<Option<&mut [u8]>, AllocatorError>
Returns a valid mapped mutable slice if the memory is host visible, otherwise it will return None. The slice already references the exact memory region of the sub allocation, so no offset needs to be applied.
§Safety
Caller needs to make sure that the allocation is still valid and coherent.
Trait Implementations§
Source§impl<LT: Clone + Lifetime> Clone for Allocation<LT>
impl<LT: Clone + Lifetime> Clone for Allocation<LT>
Source§fn clone(&self) -> Allocation<LT>
fn clone(&self) -> Allocation<LT>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreimpl<LT: Lifetime> Send for Allocation<LT>
impl<LT: Lifetime> Sync for Allocation<LT>
Auto Trait Implementations§
impl<LT> Freeze for Allocation<LT>where
LT: Freeze,
impl<LT> RefUnwindSafe for Allocation<LT>where
LT: RefUnwindSafe,
impl<LT> Unpin for Allocation<LT>where
LT: Unpin,
impl<LT> UnwindSafe for Allocation<LT>where
LT: UnwindSafe,
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