use snafu::prelude::*; #[derive(Debug, Snafu)] pub enum DecodeError { #[snafu(display("Unexpected end of input"))] UnexpectedEndOfInput, #[snafu(display("Malformed whisker at position `{}`", position))] MalformedWhisker { position: usize }, #[snafu(display("Duplicate whisker at position `{}`", position))] DuplicateWhisker { position: usize }, #[snafu(display("CRC checksum mismatch"))] CrcMismatch, } #[derive(Debug, Snafu)] pub enum EncodeError { #[snafu(display("New data is a duplicate of an existing data"))] DuplicateData, #[snafu(display("Given data causes CATS packet to overflow"))] CatsOverflow, }