pub struct VirtualBlock { /* private fields */ }Expand description
Virtual TLSF allocator; owns host metadata and no native objects.
Mutations require exclusive access. Drop releases Rust metadata only. This is not a Vulkan memory block or a pool with GPU lifetime tracking.
Implementations§
Source§impl VirtualBlock
impl VirtualBlock
pub fn new(size: u64) -> Result<Self, AllocError>
Sourcepub fn allocate(
&mut self,
size: u64,
alignment: u64,
strategy: PlacementStrategy,
) -> Result<VirtualAllocation, AllocError>
pub fn allocate( &mut self, size: u64, alignment: u64, strategy: PlacementStrategy, ) -> Result<VirtualAllocation, AllocError>
Allocate an aligned region using the chosen donor search order.
Sourcepub fn free(
&mut self,
allocation: &mut VirtualAllocation,
) -> Result<(), AllocError>
pub fn free( &mut self, allocation: &mut VirtualAllocation, ) -> Result<(), AllocError>
Release a matching live identity. No native resource is destroyed or waited on.
Sourcepub fn allocation_info(
&self,
allocation: &VirtualAllocation,
) -> Result<VirtualAllocationInfo, AllocError>
pub fn allocation_info( &self, allocation: &VirtualAllocation, ) -> Result<VirtualAllocationInfo, AllocError>
Validate identity/generation and return the current offset/size snapshot.
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Invalidate all tokens and restore the full range, retaining host capacity. Users of previously returned offsets must stop using them before reuse.
Sourcepub fn statistics(&self) -> VirtualBlockStats
pub fn statistics(&self) -> VirtualBlockStats
Calculate detailed free-span statistics; this is not a constant-time hot path.
Auto Trait Implementations§
impl Freeze for VirtualBlock
impl RefUnwindSafe for VirtualBlock
impl Send for VirtualBlock
impl Sync for VirtualBlock
impl Unpin for VirtualBlock
impl UnsafeUnpin for VirtualBlock
impl UnwindSafe for VirtualBlock
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