[][src]Struct futures_ext::BytesStream

pub struct BytesStream<S> { /* fields omitted */ }

A structure that wraps a Stream of Bytes and lets it being accessed both as a Stream and as AsyncRead. It is very useful when decoding Stream of Bytes in an asynchronous way.

Implementations

impl<S: Stream<Item = Bytes>> BytesStream<S>[src]

pub fn new(stream: S) -> Self[src]

Create a new instance of BytesStream wrapping the given Stream of Bytes

pub fn is_empty(&self) -> bool[src]

Returns true if there are no more bytes left to be consumed

pub fn into_parts(self) -> (Bytes, S)[src]

Consumes this combinator returning a pair of bytes that have been received, but not yet consumed and the Stream that can possibly yield more bytes

pub fn into_future_decode<Dec>(self, decoder: Dec) -> BytesStreamFuture<S, Dec> where
    Dec: Decoder,
    Dec::Error: From<S::Error>, 
[src]

Returns a future that yields a single decoded item from the Bytes of this BytesStream (if any) and the remaining BytesStream.

pub fn prepend_bytes(&mut self, bytes: Bytes)[src]

Adds some bytes to the front of the BytesStream internal buffer. Those bytes are ready to be read immediately after this function completes.

Trait Implementations

impl<S> AsyncRead for BytesStream<S> where
    S: Stream<Item = Bytes, Error = Error>, 
[src]

impl<S> BufRead for BytesStream<S> where
    S: Stream<Item = Bytes, Error = Error>, 
[src]

impl<S: Debug> Debug for BytesStream<S>[src]

impl<S: Stream<Item = Bytes>> From<S> for BytesStream<S>[src]

impl<S> Read for BytesStream<S> where
    S: Stream<Item = Bytes, Error = Error>, 
[src]

Auto Trait Implementations

impl<S> RefUnwindSafe for BytesStream<S> where
    S: RefUnwindSafe
[src]

impl<S> Send for BytesStream<S> where
    S: Send
[src]

impl<S> Sync for BytesStream<S> where
    S: Sync
[src]

impl<S> Unpin for BytesStream<S> where
    S: Unpin
[src]

impl<S> UnwindSafe for BytesStream<S> where
    S: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<R> ReadBytesExt for R where
    R: Read + ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.