pub struct StreamingManager { /* private fields */ }Expand description
Priority queue of pending asset loads.
Requests are dequeued in descending priority order. Ties are broken by enqueue time (older requests first — FIFO within a priority tier).
Implementations§
Source§impl StreamingManager
impl StreamingManager
Sourcepub fn new(batch_size: usize) -> Self
pub fn new(batch_size: usize) -> Self
Create a new manager.
batch_size — how many requests drain() returns at once.
Sourcepub fn enqueue(&mut self, req: StreamRequest)
pub fn enqueue(&mut self, req: StreamRequest)
Enqueue a load request.
If a request for the same ID already exists at a lower priority it is upgraded in-place. Duplicate same-priority requests are ignored.
Sourcepub fn drain(&mut self) -> Vec<StreamRequest>
pub fn drain(&mut self) -> Vec<StreamRequest>
Drain up to batch_size requests from the queue, highest priority first.
The returned requests have been removed from the queue.
Sourcepub fn cancel(&mut self, id: u64) -> bool
pub fn cancel(&mut self, id: u64) -> bool
Remove a pending request by ID (e.g. asset was evicted before loading).
Sourcepub fn total_processed(&self) -> u64
pub fn total_processed(&self) -> u64
Total requests ever processed (drained).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StreamingManager
impl RefUnwindSafe for StreamingManager
impl Send for StreamingManager
impl Sync for StreamingManager
impl Unpin for StreamingManager
impl UnsafeUnpin for StreamingManager
impl UnwindSafe for StreamingManager
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.