pub struct UploadQueue { /* private fields */ }Expand description
An asynchronous upload queue that batches host-to-device transfers.
Implementations§
Source§impl UploadQueue
impl UploadQueue
Sourcepub fn with_config(config: UploadQueueConfig) -> Self
pub fn with_config(config: UploadQueueConfig) -> Self
Create a new upload queue with the given configuration.
Sourcepub fn enqueue(
&mut self,
data: Vec<u8>,
target: UploadTarget,
priority: UploadPriority,
) -> Option<UploadId>
pub fn enqueue( &mut self, data: Vec<u8>, target: UploadTarget, priority: UploadPriority, ) -> Option<UploadId>
Enqueue an upload request. Returns the UploadId if successful,
or None if the queue is full.
Sourcepub fn flush(&mut self) -> Vec<UploadId>
pub fn flush(&mut self) -> Vec<UploadId>
Flush a batch of uploads, simulating the transfer to GPU. Returns the IDs of requests that were processed.
Sourcepub fn pending_count(&self) -> usize
pub fn pending_count(&self) -> usize
Return the number of pending requests.
Sourcepub fn queued_bytes(&self) -> usize
pub fn queued_bytes(&self) -> usize
Return the total queued bytes.
Sourcepub fn request_state(&self, id: UploadId) -> Option<UploadState>
pub fn request_state(&self, id: UploadId) -> Option<UploadState>
Return the state of a request by ID.
Sourcepub fn stats(&self) -> UploadQueueStats
pub fn stats(&self) -> UploadQueueStats
Return statistics about the queue.
Sourcepub fn peek_next(&self) -> Option<&UploadRequest>
pub fn peek_next(&self) -> Option<&UploadRequest>
Peek at the next request that would be processed.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for UploadQueue
impl RefUnwindSafe for UploadQueue
impl Send for UploadQueue
impl Sync for UploadQueue
impl Unpin for UploadQueue
impl UnsafeUnpin for UploadQueue
impl UnwindSafe for UploadQueue
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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