[][src]Struct twitchchat::Decoder

pub struct Decoder<R> { /* fields omitted */ }

A decoder over std::io::Read that produces IrcMessages

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

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

Implementations

impl<R> Decoder<R> where
    R: Read
[src]

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

Create a new Decoder from this std::io::Read instance

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

Read the next message.

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

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

pub fn iter(&mut self) -> &mut Self[src]

Returns an iterator over messages.

This will produce Results of Messages until an EOF is received

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

Consume the decoder returning the inner Reader

Trait Implementations

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

impl<R: Read> Iterator for Decoder<R>[src]

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

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

The type of the elements being iterated over.

Auto Trait Implementations

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

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

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

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

impl<R> UnwindSafe for Decoder<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<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

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.