From 2b55d9c1908d33ff25197218852c1aab4193fada Mon Sep 17 00:00:00 2001 From: sosthene-nitrokey Date: Wed, 2 Oct 2024 10:05:12 +0000 Subject: [PATCH] deploy: da58de381d5810e19f1b427013d117199c58ca59 --- cbor_smol/de/index.html | 2 +- cbor_smol/de/struct.Deserializer.html | 34 ++++++++++++------------- src/cbor_smol/de.rs.html | 36 ++++++++++++++++++++++++--- 3 files changed, 50 insertions(+), 22 deletions(-) diff --git a/cbor_smol/de/index.html b/cbor_smol/de/index.html index 4604c31..87282ff 100644 --- a/cbor_smol/de/index.html +++ b/cbor_smol/de/index.html @@ -1,3 +1,3 @@ -cbor_smol::de - Rust

Module cbor_smol::de

source ·

Structs§

  • A structure for deserializing a cbor-smol message.

Functions§

source§

fn deserialize_enum<V>( self, _name: &'static str, _variants: &'static [&'static str], visitor: V, ) -> Result<V::Value>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting an enum value with a -particular name and possible variants.
source§

fn deserialize_identifier<V>(self, visitor: V) -> Result<V::Value>
where +particular name and possible variants.

source§

fn deserialize_identifier<V>(self, visitor: V) -> Result<V::Value>
where V: Visitor<'de>,

Hint that the Deserialize type is expecting the name of a struct -field or the discriminant of an enum variant.
source§

fn deserialize_ignored_any<V>(self, visitor: V) -> Result<V::Value>
where +field or the discriminant of an enum variant.

source§

fn deserialize_ignored_any<V>(self, visitor: V) -> Result<V::Value>
where V: Visitor<'de>,

Hint that the Deserialize type needs to deserialize a value whose type doesn’t matter because it is ignored. Read more
source§

fn deserialize_i128<V>( self, diff --git a/src/cbor_smol/de.rs.html b/src/cbor_smol/de.rs.html index 51fa8eb..9ede640 100644 --- a/src/cbor_smol/de.rs.html +++ b/src/cbor_smol/de.rs.html @@ -1264,6 +1264,20 @@ 1264 1265 1266 +1267 +1268 +1269 +1270 +1271 +1272 +1273 +1274 +1275 +1276 +1277 +1278 +1279 +1280
use serde::Deserialize;
 
 use serde::de::IntoDeserializer;
@@ -1863,10 +1877,24 @@
     where
         V: Visitor<'de>,
     {
-        // major type 2: "byte string"
-        let length = self.raw_deserialize_u32(MAJOR_BYTES)? as usize;
-        let bytes: &'de [u8] = self.try_take_n(length)?;
-        visitor.visit_borrowed_bytes(bytes)
+        let major = self.peek_major()?;
+        match major {
+            #[cfg(feature = "bytes-from-array")]
+            MAJOR_ARRAY => {
+                let len = self.raw_deserialize_u32(MAJOR_ARRAY)?;
+                visitor.visit_seq(SeqAccess {
+                    deserializer: self,
+                    len: len as usize,
+                })
+            }
+            MAJOR_BYTES => {
+                // major type 2: "byte string"
+                let length = self.raw_deserialize_u32(MAJOR_BYTES)? as usize;
+                let bytes: &'de [u8] = self.try_take_n(length)?;
+                visitor.visit_borrowed_bytes(bytes)
+            }
+            _ => Err(Error::DeserializeBadMajor),
+        }
     }
 
     fn deserialize_byte_buf<V>(self, visitor: V) -> Result<V::Value>