pub struct GpuMemoryPool { /* private fields */ }Expand description
GPU memory pool allocator.
Implementations§
Source§impl GpuMemoryPool
impl GpuMemoryPool
Sourcepub fn new(block_size: usize) -> Self
pub fn new(block_size: usize) -> Self
Create a new pool.
block_size– size of each new backing block in bytes.
Sourcepub fn alloc(
&mut self,
size: usize,
alignment: Alignment,
) -> Option<AllocationHandle>
pub fn alloc( &mut self, size: usize, alignment: Alignment, ) -> Option<AllocationHandle>
Allocate size bytes with the given alignment.
Returns an AllocationHandle on success. If no existing block can
satisfy the request, a new backing block is created.
Sourcepub fn free(&mut self, handle: &AllocationHandle)
pub fn free(&mut self, handle: &AllocationHandle)
Free a previously allocated handle.
Sourcepub fn block_count(&self) -> usize
pub fn block_count(&self) -> usize
Total number of backing blocks.
Sourcepub fn free_bytes(&self) -> usize
pub fn free_bytes(&self) -> usize
Total free bytes across all blocks.
Auto Trait Implementations§
impl Freeze for GpuMemoryPool
impl RefUnwindSafe for GpuMemoryPool
impl Send for GpuMemoryPool
impl Sync for GpuMemoryPool
impl Unpin for GpuMemoryPool
impl UnsafeUnpin for GpuMemoryPool
impl UnwindSafe for GpuMemoryPool
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more