pub struct StreamingAllocator { /* private fields */ }Expand description
Streaming allocator for large assets.
Implementations§
Source§impl StreamingAllocator
impl StreamingAllocator
Sourcepub fn set_eviction_callback<F>(&self, callback: F)
pub fn set_eviction_callback<F>(&self, callback: F)
Set a callback for when allocations are evicted.
Sourcepub fn reserve(&self, size: usize, priority: StreamPriority) -> Option<StreamId>
pub fn reserve(&self, size: usize, priority: StreamPriority) -> Option<StreamId>
Reserve memory for a streaming asset.
Returns None if the budget would be exceeded and eviction fails.
Sourcepub fn reserve_tagged(
&self,
size: usize,
priority: StreamPriority,
tag: Option<&'static str>,
) -> Option<StreamId>
pub fn reserve_tagged( &self, size: usize, priority: StreamPriority, tag: Option<&'static str>, ) -> Option<StreamId>
Reserve memory with a tag for categorization.
Sourcepub fn begin_load(&self, id: StreamId) -> Option<*mut u8>
pub fn begin_load(&self, id: StreamId) -> Option<*mut u8>
Get a pointer for writing data into a streaming allocation.
Returns None if the ID is invalid or the allocation is not in a writable state.
Sourcepub fn report_progress(&self, id: StreamId, bytes_loaded: usize)
pub fn report_progress(&self, id: StreamId, bytes_loaded: usize)
Report progress on loading.
Sourcepub fn finish_load(&self, id: StreamId)
pub fn finish_load(&self, id: StreamId)
Mark a streaming allocation as fully loaded.
Sourcepub fn access(&self, id: StreamId) -> Option<*const u8>
pub fn access(&self, id: StreamId) -> Option<*const u8>
Access a ready allocation.
Updates the LRU timestamp.
Sourcepub fn next_frame(&self)
pub fn next_frame(&self)
Advance to the next frame (for LRU tracking).
Sourcepub fn total_reserved(&self) -> usize
pub fn total_reserved(&self) -> usize
Get total reserved bytes.
Sourcepub fn total_loaded(&self) -> usize
pub fn total_loaded(&self) -> usize
Get total loaded bytes.
Sourcepub fn state(&self, id: StreamId) -> Option<StreamState>
pub fn state(&self, id: StreamId) -> Option<StreamState>
Get the state of an allocation.
Sourcepub fn stats(&self) -> StreamingStats
pub fn stats(&self) -> StreamingStats
Get statistics about streaming allocations.
Trait Implementations§
impl Send for StreamingAllocator
impl Sync for StreamingAllocator
Auto Trait Implementations§
impl !Freeze for StreamingAllocator
impl RefUnwindSafe for StreamingAllocator
impl Unpin for StreamingAllocator
impl UnwindSafe for StreamingAllocator
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