use crate::encoding;
#[derive(Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[non_exhaustive]
pub enum DecodeError {
InvalidVarint,
VarintTooLarge(u64),
BufferUnderflow,
UnexpectedEndGroupTag,
InvalidWireTypeValue(u64),
UnexpectedWireTypeValue {
actual: encoding::WireType,
expected: encoding::WireType,
},
UnexpectedTagValue(u32),
InvalidKeyValue(u64),
InvalidTagValue(u32),
InvalidUtf8 {
valid_up_to: usize,
error_len: Option<usize>,
},
}
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub struct EncodeError {
pub required: usize,
pub remaining: usize,
}
impl EncodeError {
pub fn new(required: usize, remaining: usize) -> Self {
Self {
required,
remaining,
}
}
}