pub struct ChunkChannel<E> { /* private fields */ }Expand description
Re-export framework services (HTTP, URI, etc.) from the dedicated services crate. 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() -> (ChunkChannel<E>, ChunkStream<E>)
pub fn new() -> (ChunkChannel<E>, 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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.