1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
use thiserror::Error; use crate::ll::marker::Marker; #[derive(Error, Debug)] pub enum DecodeError { #[error("IO error while reading: {0}")] ReadIOError(#[from] std::io::Error), #[error("Unexpected marker '{0}'")] UnexpectedMarker(Marker), #[error("Unknown marker byte '{0}'")] UnknownMarkerByte(u8), #[error("Cannot read size info as usize")] CannotReadSizeInfo, #[error("Unexpected tag byte '{0}'")] UnexpectedTagByte(u8), #[error("Expected {0} fields but got {1}")] UnexpectedNumberOfFields(usize, usize), } #[derive(Error, Debug)] pub enum EncodeError { #[error("IO error while writing: {0}")] WriteIOError(#[from] std::io::Error), #[error("Too many struct fields: {0}")] TooManyStructFields(usize) }