pub struct SimpleMemoryManagement<Storage> { /* private fields */ }
Expand description
Reserves and keeps track of chunks of memory in the storage, and slices upon these chunks.
Implementations§
source§impl<Storage: ComputeStorage> SimpleMemoryManagement<Storage>
impl<Storage: ComputeStorage> SimpleMemoryManagement<Storage>
sourcepub fn new(
storage: Storage,
dealloc_strategy: DeallocStrategy,
slice_strategy: SliceStrategy,
) -> Self
pub fn new( storage: Storage, dealloc_strategy: DeallocStrategy, slice_strategy: SliceStrategy, ) -> Self
Creates a new instance using the given storage, deallocation strategy and slice strategy.
Trait Implementations§
source§impl<Storage> Debug for SimpleMemoryManagement<Storage>
impl<Storage> Debug for SimpleMemoryManagement<Storage>
source§impl<Storage: ComputeStorage> MemoryManagement<Storage> for SimpleMemoryManagement<Storage>
impl<Storage: ComputeStorage> MemoryManagement<Storage> for SimpleMemoryManagement<Storage>
source§fn get(&mut self, binding: Self::Binding) -> Storage::Resource
fn get(&mut self, binding: Self::Binding) -> Storage::Resource
Returns the resource from the storage, for the specified handle.
source§fn reserve<Sync: FnOnce()>(&mut self, size: usize, _sync: Sync) -> Self::Handle
fn reserve<Sync: FnOnce()>(&mut self, size: usize, _sync: Sync) -> Self::Handle
Reserves memory of specified size using the reserve algorithm, and return a handle to the reserved memory.
Also clean ups, removing unused slices, and chunks if permitted by deallocation strategy.
§type Handle = SimpleHandle
type Handle = SimpleHandle
The associated type that must implement MemoryHandle.
§type Binding = SimpleBinding
type Binding = SimpleBinding
The associated type that must implement MemoryBinding
source§fn alloc<Sync: FnOnce()>(&mut self, size: usize, _sync: Sync) -> Self::Handle
fn alloc<Sync: FnOnce()>(&mut self, size: usize, _sync: Sync) -> Self::Handle
Bypass the memory allocation algorithm to allocate data directly. Read more
source§fn dealloc(&mut self, binding: Self::Binding)
fn dealloc(&mut self, binding: Self::Binding)
Bypass the memory allocation algorithm to deallocate data directly. Read more
source§fn storage(&mut self) -> &mut Storage
fn storage(&mut self) -> &mut Storage
Fetch the storage used by the memory manager. Read more
Auto Trait Implementations§
impl<Storage> Freeze for SimpleMemoryManagement<Storage>where
Storage: Freeze,
impl<Storage> RefUnwindSafe for SimpleMemoryManagement<Storage>where
Storage: RefUnwindSafe,
impl<Storage> Send for SimpleMemoryManagement<Storage>where
Storage: Send,
impl<Storage> Sync for SimpleMemoryManagement<Storage>where
Storage: Sync,
impl<Storage> Unpin for SimpleMemoryManagement<Storage>where
Storage: Unpin,
impl<Storage> UnwindSafe for SimpleMemoryManagement<Storage>where
Storage: 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