pub struct ByteStream { /* private fields */ }Expand description
Platform-agnostic byte stream abstraction
Implementations§
Source§impl ByteStream
impl ByteStream
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Check if stream is known to be empty (always false for dynamic streams)
Sourcepub fn into_inner(
self,
) -> Pin<Box<dyn Stream<Item = Result<Bytes, StreamError>> + Send>>
pub fn into_inner( self, ) -> Pin<Box<dyn Stream<Item = Result<Bytes, StreamError>> + Send>>
Convert into the inner boxed stream
Sourcepub fn tee(self) -> (ByteStream, ByteStream)
pub fn tee(self) -> (ByteStream, ByteStream)
Split this stream into two streams that both receive all chunks
Chunks are cloned (cheaply via Bytes rc). Spawns a forwarder task. Both returned streams will receive all chunks from the original stream. The forwarder continues as long as at least one stream is alive. If the underlying stream errors, both teed streams will end.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ByteStream
impl !RefUnwindSafe for ByteStream
impl Send for ByteStream
impl !Sync for ByteStream
impl Unpin for ByteStream
impl !UnwindSafe for ByteStream
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more