use cbor4ii::core::dec;
use crate::error::DecodeError;
#[allow(dead_code)]
pub(crate) mod marker {
pub const START: u8 = 0x1f;
pub const FALSE: u8 = 0xf4; pub const TRUE: u8 = 0xf5; pub const NULL: u8 = 0xf6; pub const UNDEFINED: u8 = 0xf7; pub const F16: u8 = 0xf9;
pub const F32: u8 = 0xfa;
pub const F64: u8 = 0xfb;
pub const BREAK: u8 = 0xff;
}
#[inline]
pub(crate) fn peek_one<'a, R: dec::Read<'a>>(reader: &mut R) -> Result<u8, DecodeError<R::Error>> {
let buf = match reader.fill(1)? {
dec::Reference::Long(buf) => buf,
dec::Reference::Short(buf) => buf,
};
let byte = buf.first().copied().ok_or(DecodeError::Eof)?;
Ok(byte)
}
#[inline]
pub(crate) fn pull_one<'a, R: dec::Read<'a>>(reader: &mut R) -> Result<u8, DecodeError<R::Error>> {
let byte = peek_one(reader)?;
reader.advance(1);
Ok(byte)
}