Struct tockloader_proto::CommandDecoder [] [src]

pub struct CommandDecoder { /* fields omitted */ }

The ComandDecoder takes bytes and gives you Commands.

Methods

impl CommandDecoder
[src]

[src]

Create a new CommandDecoder.

The decoder is fed bytes with the receive method.

[src]

Decode a whole buffers worth of bytes.

Due to lifetime problems, the decoded Commands are sent via callback rather than being returned.

[src]

Empty the RX buffer.

[src]

Process incoming bytes.

The decoder is fed bytes with the receive method. If not enough bytes have been seen, this function returns None. Once enough bytes have been seen, it returns Ok(Some(Command)) containing the decoded Command. It returns Err if it doesn't like the byte received.