pub struct ChunkChannel<E> { /* private fields */ }Expand description
The producing half of a chunked byte stream.
Held by whatever is doing the blocking read. Dropping it without calling
ChunkChannel::finish or ChunkChannel::fail ends the stream, so a
worker that panics does not leave a reader waiting for ever.
Implementations§
Source§impl<E> ChunkChannel<E>
impl<E> ChunkChannel<E>
Sourcepub fn new() -> (Self, ChunkStream<E>)
pub fn new() -> (Self, ChunkStream<E>)
Creates a channel and its reading half.
Sourcepub fn push(&self, chunk: Vec<u8>) -> bool
pub fn push(&self, chunk: Vec<u8>) -> bool
Publishes one chunk, waiting while the consumer is more than
MAX_PENDING_CHUNKS behind.
Returns false once the consumer has gone, which is the producer’s
signal to stop reading.
Sourcepub fn is_abandoned(&self) -> bool
pub fn is_abandoned(&self) -> bool
Whether the consumer has gone.
Trait Implementations§
Source§impl<E> Drop for ChunkChannel<E>
impl<E> Drop for ChunkChannel<E>
Auto Trait Implementations§
impl<E> Freeze for ChunkChannel<E>
impl<E> RefUnwindSafe for ChunkChannel<E>where
Arc<ChunkShared<E>>: RefUnwindSafe,
impl<E> Send for ChunkChannel<E>
impl<E> Sync for ChunkChannel<E>
impl<E> Unpin for ChunkChannel<E>
impl<E> UnsafeUnpin for ChunkChannel<E>where
Arc<ChunkShared<E>>: UnsafeUnpin,
impl<E> UnwindSafe for ChunkChannel<E>where
Arc<ChunkShared<E>>: 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