pub use crate::codec_err::DecodeError;
use crate::{DecodeErrorHandler, TryStaticCast};
pub trait NestedDecodeInput {
    fn remaining_len(&self) -> usize;
    fn is_depleted(&self) -> bool {
        self.remaining_len() == 0
    }
    fn peek_into<H>(&mut self, into: &mut [u8], h: H) -> Result<(), H::HandledErr>
    where
        H: DecodeErrorHandler;
    fn read_into<H>(&mut self, into: &mut [u8], h: H) -> Result<(), H::HandledErr>
    where
        H: DecodeErrorHandler;
    #[inline]
    fn supports_specialized_type<T: TryStaticCast>() -> bool {
        false
    }
    fn read_specialized<T, C, H>(&mut self, _context: C, h: H) -> Result<T, H::HandledErr>
    where
        T: TryStaticCast,
        C: TryStaticCast,
        H: DecodeErrorHandler,
    {
        Err(h.handle_error(DecodeError::UNSUPPORTED_OPERATION))
    }
    fn read_byte<H>(&mut self, h: H) -> Result<u8, H::HandledErr>
    where
        H: DecodeErrorHandler,
    {
        let mut buf = [0u8];
        self.read_into(&mut buf[..], h)?;
        Ok(buf[0])
    }
}