From 0b57b493d0c87c492ad7b791ea4d427dfeb0801b Mon Sep 17 00:00:00 2001 From: Mingun Date: Sun, 7 May 2023 20:01:14 +0500 Subject: [PATCH] Better document SeqAccessDeserializer and MapAccessDeserializer --- serde/src/de/value.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/serde/src/de/value.rs b/serde/src/de/value.rs index b0d13b4d6..545417415 100644 --- a/serde/src/de/value.rs +++ b/serde/src/de/value.rs @@ -1045,6 +1045,12 @@ where //////////////////////////////////////////////////////////////////////////////// /// A deserializer holding a `SeqAccess`. +/// +/// This deserializer will call [`Visitor::visit_seq`] for all requests except +/// for [`Deserializer::deserialize_enum`]. In the latest case the enum will be +/// deserialized from the first two elements of a sequence. The first element +/// would be interpreted as a variant name and the second as a content of +/// a variant. In case of unit variant the second element is optional. #[derive(Clone, Debug)] pub struct SeqAccessDeserializer { seq: A, @@ -1479,6 +1485,12 @@ where //////////////////////////////////////////////////////////////////////////////// /// A deserializer holding a `MapAccess`. +/// +/// This deserializer will call [`Visitor::visit_map`] for all requests except +/// for [`Deserializer::deserialize_enum`]. In the latest case the enum will be +/// deserialized from the first entry of a map. The map key would be interpreted +/// as a variant name and the map value would be interpreted as a content of +/// a variant. #[derive(Clone, Debug)] pub struct MapAccessDeserializer { map: A,