Struct tockloader_proto::CommandDecoder
[−]
[src]
pub struct CommandDecoder { /* fields omitted */ }The ComandDecoder takes bytes and gives you Commands.
Methods
impl CommandDecoder[src]
fn new() -> CommandDecoder[src]
Create a new CommandDecoder.
The decoder is fed bytes with the receive method.
fn reset(&mut self)[src]
Empty the RX buffer.
fn receive(&mut self, ch: u8) -> Result<Option<Command>, Error>[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.