use serde::de::{self, Visitor}; use super::{Deserializer, Error, Result}; pub struct IdDeserializer<'a, 'b: 'a> { d: &'a mut Deserializer<'b>, } impl<'a, 'b: 'a> IdDeserializer<'a, 'b> { pub fn new(d: &'a mut Deserializer<'b>) -> Self { IdDeserializer { d } } } impl<'a, 'b: 'a, 'c> de::Deserializer<'b> for &'c mut IdDeserializer<'a, 'b> { type Error = Error; fn deserialize_identifier(self, visitor: V) -> Result where V: Visitor<'b>, { self.d.deserialize_identifier(visitor) } fn deserialize_str(self, visitor: V) -> Result where V: Visitor<'b>, { self.deserialize_identifier(visitor) } fn deserialize_any(self, visitor: V) -> Result where V: Visitor<'b>, { self.deserialize_identifier(visitor) } fn deserialize_bool(self, _: V) -> Result where V: Visitor<'b>, { unimplemented!("IdDeserializer may only be used for identifiers") } fn deserialize_i8(self, _: V) -> Result where V: Visitor<'b>, { unimplemented!("IdDeserializer may only be used for identifiers") } fn deserialize_i16(self, _: V) -> Result where V: Visitor<'b>, { unimplemented!("IdDeserializer may only be used for identifiers") } fn deserialize_i32(self, _: V) -> Result where V: Visitor<'b>, { unimplemented!("IdDeserializer may only be used for identifiers") } fn deserialize_i64(self, _: V) -> Result where V: Visitor<'b>, { unimplemented!("IdDeserializer may only be used for identifiers") } #[cfg(feature = "integer128")] fn deserialize_i128(self, _: V) -> Result where V: Visitor<'b>, { unimplemented!("IdDeserializer may only be used for identifiers") } fn deserialize_u8(self, _: V) -> Result where V: Visitor<'b>, { unimplemented!("IdDeserializer may only be used for identifiers") } fn deserialize_u16(self, _: V) -> Result where V: Visitor<'b>, { unimplemented!("IdDeserializer may only be used for identifiers") } fn deserialize_u32(self, _: V) -> Result where V: Visitor<'b>, { unimplemented!("IdDeserializer may only be used for identifiers") } fn deserialize_u64(self, _: V) -> Result where V: Visitor<'b>, { unimplemented!("IdDeserializer may only be used for identifiers") } #[cfg(feature = "integer128")] fn deserialize_u128(self, _: V) -> Result where V: Visitor<'b>, { unimplemented!("IdDeserializer may only be used for identifiers") } fn deserialize_f32(self, _: V) -> Result where V: Visitor<'b>, { unimplemented!("IdDeserializer may only be used for identifiers") } fn deserialize_f64(self, _: V) -> Result where V: Visitor<'b>, { unimplemented!("IdDeserializer may only be used for identifiers") } fn deserialize_char(self, _: V) -> Result where V: Visitor<'b>, { unimplemented!("IdDeserializer may only be used for identifiers") } fn deserialize_string(self, _: V) -> Result where V: Visitor<'b>, { unimplemented!("IdDeserializer may only be used for identifiers") } fn deserialize_bytes(self, _: V) -> Result where V: Visitor<'b>, { unimplemented!("IdDeserializer may only be used for identifiers") } fn deserialize_byte_buf(self, _: V) -> Result where V: Visitor<'b>, { unimplemented!("IdDeserializer may only be used for identifiers") } fn deserialize_option(self, _: V) -> Result where V: Visitor<'b>, { unimplemented!("IdDeserializer may only be used for identifiers") } fn deserialize_unit(self, _: V) -> Result where V: Visitor<'b>, { unimplemented!("IdDeserializer may only be used for identifiers") } fn deserialize_unit_struct(self, _: &'static str, _: V) -> Result where V: Visitor<'b>, { unimplemented!("IdDeserializer may only be used for identifiers") } fn deserialize_newtype_struct(self, _: &'static str, _: V) -> Result where V: Visitor<'b>, { unimplemented!("IdDeserializer may only be used for identifiers") } fn deserialize_seq(self, _: V) -> Result where V: Visitor<'b>, { unimplemented!("IdDeserializer may only be used for identifiers") } fn deserialize_tuple(self, _: usize, _: V) -> Result where V: Visitor<'b>, { unimplemented!("IdDeserializer may only be used for identifiers") } fn deserialize_tuple_struct(self, _: &'static str, _: usize, _: V) -> Result where V: Visitor<'b>, { unimplemented!("IdDeserializer may only be used for identifiers") } fn deserialize_map(self, _: V) -> Result where V: Visitor<'b>, { unimplemented!("IdDeserializer may only be used for identifiers") } fn deserialize_struct( self, _: &'static str, _: &'static [&'static str], _: V, ) -> Result where V: Visitor<'b>, { unimplemented!("IdDeserializer may only be used for identifiers") } fn deserialize_enum( self, _: &'static str, _: &'static [&'static str], _: V, ) -> Result where V: Visitor<'b>, { unimplemented!("IdDeserializer may only be used for identifiers") } fn deserialize_ignored_any(self, visitor: V) -> Result where V: Visitor<'b>, { self.deserialize_any(visitor) } }