[][src]Struct twitchchat::AsyncDecoder

pub struct AsyncDecoder<R> { /* fields omitted */ }
This is supported on crate feature async only.

A decoder over futures_lite::AsyncRead that produces IrcMessages

This will return an DecodeError::Eof when its done reading manually.

When reading it as a stream, Eof will signal the end of the stream (e.g. None)

Implementations

impl<R: AsyncRead + Send + Sync + Unpin> AsyncDecoder<R>[src]

pub fn new(reader: R) -> Self[src]

Create a new AsyncDecoder from this futures_lite::AsyncRead instance

pub async fn read_message<'_, '_>(
    &'_ mut self
) -> Result<IrcMessage<'_>, DecodeError>
[src]

Read the next message.

This returns a borrowed IrcMessage which is valid until the next AsyncDecoder call is made.

If you just want an owned one, use the AsyncDecoder as an stream. e.g. dec.next().

pub fn into_inner(self) -> R[src]

Consume the decoder returning the inner Reader

Trait Implementations

impl<R> Debug for AsyncDecoder<R>[src]

impl<R> Stream for AsyncDecoder<R> where
    R: AsyncRead + Send + Sync + Unpin
[src]

This will produce Result<IrcMessage<'static>, DecodeError> until an Eof is received

type Item = Result<IrcMessage<'static>, DecodeError>

Values yielded by the stream.

Auto Trait Implementations

impl<R> RefUnwindSafe for AsyncDecoder<R> where
    R: RefUnwindSafe

impl<R> Send for AsyncDecoder<R> where
    R: Send

impl<R> Sync for AsyncDecoder<R> where
    R: Sync

impl<R> Unpin for AsyncDecoder<R> where
    R: Unpin

impl<R> UnwindSafe for AsyncDecoder<R> where
    R: UnwindSafe

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<S> StreamExt for S where
    S: Stream + ?Sized

impl<T> StreamExt for T where
    T: Stream + ?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.

impl<S, T, E> TryStream for S where
    S: Stream<Item = Result<T, E>> + ?Sized
[src]

type Ok = T

The type of successful values yielded by this future

type Error = E

The type of failures yielded by this future