From 7bcdc3b4ca460aec2b98fb2dca6165788c562b05 Mon Sep 17 00:00:00 2001 From: Igor Tolmachev Date: Sat, 20 Jul 2024 16:52:39 +0900 Subject: Partial aes implementation and others improvements --- src/structs/de.rs | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) (limited to 'src/structs/de.rs') diff --git a/src/structs/de.rs b/src/structs/de.rs index edd8011..8b2130e 100644 --- a/src/structs/de.rs +++ b/src/structs/de.rs @@ -1,5 +1,4 @@ use crate::structs::{Settings, StructError, StructResult}; -use crate::ArchiveError; use serde::de; pub struct ArchiveDeserializer<'de> { @@ -60,14 +59,14 @@ impl<'a, 'de> EnumDeserializer<'a, 'de> { } impl<'de> de::Deserializer<'de> for &mut ArchiveDeserializer<'de> { - type Error = ArchiveError; + type Error = StructError; #[inline] fn deserialize_any(self, _visitor: V) -> StructResult where V: de::Visitor<'de>, { - Err(StructError::DeserializationNotSupported { type_name: "any" }.into()) + Err(StructError::DeserializationNotSupported("any")) } fn deserialize_bool(self, visitor: V) -> StructResult @@ -160,7 +159,7 @@ impl<'de> de::Deserializer<'de> for &mut ArchiveDeserializer<'de> { where V: de::Visitor<'de>, { - Err(StructError::DeserializationNotSupported { type_name: "char" }.into()) + Err(StructError::DeserializationNotSupported("char")) } #[inline] @@ -168,7 +167,7 @@ impl<'de> de::Deserializer<'de> for &mut ArchiveDeserializer<'de> { where V: de::Visitor<'de>, { - Err(StructError::DeserializationNotSupported { type_name: "str" }.into()) + Err(StructError::DeserializationNotSupported("str")) } #[inline] @@ -176,10 +175,7 @@ impl<'de> de::Deserializer<'de> for &mut ArchiveDeserializer<'de> { where V: de::Visitor<'de>, { - Err(StructError::DeserializationNotSupported { - type_name: "string", - } - .into()) + Err(StructError::DeserializationNotSupported("string")) } #[inline] @@ -187,7 +183,7 @@ impl<'de> de::Deserializer<'de> for &mut ArchiveDeserializer<'de> { where V: de::Visitor<'de>, { - Err(StructError::DeserializationNotSupported { type_name: "bytes" }.into()) + Err(StructError::DeserializationNotSupported("bytes")) } #[inline] @@ -195,7 +191,7 @@ impl<'de> de::Deserializer<'de> for &mut ArchiveDeserializer<'de> { where V: de::Visitor<'de>, { - Err(StructError::DeserializationNotSupported { type_name: "bytes" }.into()) + Err(StructError::DeserializationNotSupported("bytes")) } #[inline] @@ -203,10 +199,7 @@ impl<'de> de::Deserializer<'de> for &mut ArchiveDeserializer<'de> { where V: de::Visitor<'de>, { - Err(StructError::DeserializationNotSupported { - type_name: "optional", - } - .into()) + Err(StructError::DeserializationNotSupported("optional")) } #[inline] @@ -242,7 +235,7 @@ impl<'de> de::Deserializer<'de> for &mut ArchiveDeserializer<'de> { where V: de::Visitor<'de>, { - Err(StructError::DeserializationNotSupported { type_name: "seq" }.into()) + Err(StructError::DeserializationNotSupported("seq")) } #[inline] @@ -271,7 +264,7 @@ impl<'de> de::Deserializer<'de> for &mut ArchiveDeserializer<'de> { where V: de::Visitor<'de>, { - Err(StructError::DeserializationNotSupported { type_name: "map" }.into()) + Err(StructError::DeserializationNotSupported("map")) } #[inline] @@ -322,7 +315,7 @@ impl<'de> de::Deserializer<'de> for &mut ArchiveDeserializer<'de> { } impl<'a, 'de> de::SeqAccess<'de> for SeqDeserializer<'a, 'de> { - type Error = ArchiveError; + type Error = StructError; fn next_element_seed(&mut self, seed: T) -> Result, Self::Error> where @@ -336,7 +329,7 @@ impl<'a, 'de> de::SeqAccess<'de> for SeqDeserializer<'a, 'de> { } impl<'a, 'de> de::EnumAccess<'de> for EnumDeserializer<'a, 'de> { - type Error = ArchiveError; + type Error = StructError; type Variant = Self; fn variant_seed(self, seed: V) -> Result<(V::Value, Self::Variant), Self::Error> @@ -348,7 +341,7 @@ impl<'a, 'de> de::EnumAccess<'de> for EnumDeserializer<'a, 'de> { } impl<'a, 'de> de::VariantAccess<'de> for EnumDeserializer<'a, 'de> { - type Error = ArchiveError; + type Error = StructError; #[inline] fn unit_variant(self) -> Result<(), Self::Error> { -- cgit v1.2.3