pub trait Deserializer<'de> {
    type Error: DeserializeError;

    fn read_bool(&mut self) -> Result<bool, Self::Error>;
    fn read_str(&mut self) -> Result<&'de str, Self::Error>;
    fn read_bytes(&mut self) -> Result<&'de [u8], Self::Error>;

    fn read_i8(&mut self) -> Result<i8, Self::Error>;
    fn read_i16(&mut self) -> Result<i16, Self::Error>;
    fn read_i32(&mut self) -> Result<i32, Self::Error>;
    fn read_i64(&mut self) -> Result<i64, Self::Error>;
    fn read_isize(&mut self) -> Result<isize, Self::Error>;
    fn read_u8(&mut self) -> Result<u8, Self::Error>;
    fn read_u16(&mut self) -> Result<u16, Self::Error>;
    fn read_u32(&mut self) -> Result<u32, Self::Error>;
    fn read_u64(&mut self) -> Result<u64, Self::Error>;
    fn read_usize(&mut self) -> Result<usize, Self::Error>;

    fn read_enum_variant(&mut self) -> Result<u32, Self::Error>;
}

pub trait Deserialize<'de>: Sized + 'de {
    fn deserialize<D: Deserializer<'de>>(deserializer: &mut D) -> Result<Self, D::Error>;
}

pub trait DeserializeError {
    const INVALID_ENUM_VARIANT: Self;
    const INVALID_ARRAY_LEN: Self;
}
