pub struct CancellableAsyncDecoder<R: AsyncRead + Unpin> { /* private fields */ }Available on crate features
alloc and async-tokio only.Expand description
An async streaming decoder with cancellation support.
Implementations§
Source§impl<R: AsyncRead + Unpin> CancellableAsyncDecoder<R>
impl<R: AsyncRead + Unpin> CancellableAsyncDecoder<R>
Sourcepub fn new(reader: R, token: CancellationToken) -> Self
pub fn new(reader: R, token: CancellationToken) -> Self
Create a new cancellable async decoder.
Sourcepub async fn read_item<T: Decode>(&mut self) -> Result<Option<T>>
pub async fn read_item<T: Decode>(&mut self) -> Result<Option<T>>
Read the next item, checking for cancellation.
Sourcepub fn progress(&self) -> &StreamingProgress
pub fn progress(&self) -> &StreamingProgress
Get current progress.
Sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
Check if finished.
Auto Trait Implementations§
impl<R> Freeze for CancellableAsyncDecoder<R>where
R: Freeze,
impl<R> RefUnwindSafe for CancellableAsyncDecoder<R>where
R: RefUnwindSafe,
impl<R> Send for CancellableAsyncDecoder<R>where
R: Send,
impl<R> Sync for CancellableAsyncDecoder<R>where
R: Sync,
impl<R> Unpin for CancellableAsyncDecoder<R>
impl<R> UnsafeUnpin for CancellableAsyncDecoder<R>where
R: UnsafeUnpin,
impl<R> UnwindSafe for CancellableAsyncDecoder<R>where
R: UnwindSafe,
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