pub struct AsyncCopyStreams { /* private fields */ }Expand description
Async copy scheduler keyed by IR stream tags.
Implementations§
Source§impl AsyncCopyStreams
impl AsyncCopyStreams
Sourcepub fn async_load<F>(
&mut self,
tag: impl Into<String>,
copy: F,
) -> Result<(), BackendError>
pub fn async_load<F>( &mut self, tag: impl Into<String>, copy: F, ) -> Result<(), BackendError>
Start copy work associated with tag.
If a tokio runtime handle is available on the current thread the
closure is dispatched to tokio::task::spawn_blocking so the
runtime’s blocking-thread pool amortizes scheduling cost. Otherwise the
crate-global bounded async-copy pool is used.
§Errors
Returns a backend error if the tag is already in flight.
Sourcepub fn async_wait(&mut self, tag: &str) -> Result<(), BackendError>
pub fn async_wait(&mut self, tag: &str) -> Result<(), BackendError>
Wait for a copy previously started by Self::async_load.
§Errors
Returns a backend error if the tag is unknown, the worker panicked, or the copy closure returned an error.
Sourcepub fn overlap_copy_compute<C, G>(
&mut self,
tag: impl Into<String>,
copy: C,
compute: G,
) -> Result<(), BackendError>where
C: FnOnce() -> Result<(), BackendError> + Send + 'static,
G: FnOnce() -> Result<(), BackendError>,
pub fn overlap_copy_compute<C, G>(
&mut self,
tag: impl Into<String>,
copy: C,
compute: G,
) -> Result<(), BackendError>where
C: FnOnce() -> Result<(), BackendError> + Send + 'static,
G: FnOnce() -> Result<(), BackendError>,
Start copy work, run compute work, then wait for the copy tag.
§Errors
Propagates copy or compute failures with their original context.
Trait Implementations§
Source§impl Default for AsyncCopyStreams
impl Default for AsyncCopyStreams
Source§fn default() -> AsyncCopyStreams
fn default() -> AsyncCopyStreams
Returns the “default value” for a type. Read more
Source§impl Drop for AsyncCopyStreams
impl Drop for AsyncCopyStreams
Auto Trait Implementations§
impl !Sync for AsyncCopyStreams
impl Freeze for AsyncCopyStreams
impl RefUnwindSafe for AsyncCopyStreams
impl Send for AsyncCopyStreams
impl Unpin for AsyncCopyStreams
impl UnsafeUnpin for AsyncCopyStreams
impl UnwindSafe for AsyncCopyStreams
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