Skip to content

Commit f4e0b77

Browse files
committed
Better document SeqAccessDeserializer and MapAccessDeserializer
1 parent 7d4703b commit f4e0b77

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

serde/src/de/value.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,6 +1051,12 @@ where
10511051
////////////////////////////////////////////////////////////////////////////////
10521052

10531053
/// A deserializer holding a `SeqAccess`.
1054+
///
1055+
/// This deserializer will call [`Visitor::visit_seq`] for all requests except
1056+
/// for [`Deserializer::deserialize_enum`]. In the latest case the enum will be
1057+
/// deserialized from the first two elements of a sequence. The first element
1058+
/// would be interpreted as a variant name and the second as a content of
1059+
/// a variant. In case of unit variant the second element is optional.
10541060
#[derive(Clone, Debug)]
10551061
pub struct SeqAccessDeserializer<A> {
10561062
seq: A,
@@ -1487,6 +1493,12 @@ where
14871493
////////////////////////////////////////////////////////////////////////////////
14881494

14891495
/// A deserializer holding a `MapAccess`.
1496+
///
1497+
/// This deserializer will call [`Visitor::visit_map`] for all requests except
1498+
/// for [`Deserializer::deserialize_enum`]. In the latest case the enum will be
1499+
/// deserialized from the first entry of a map. The map key would be interpreted
1500+
/// as a variant name and the map value would be interpreted as a content of
1501+
/// a variant.
14901502
#[derive(Clone, Debug)]
14911503
pub struct MapAccessDeserializer<A> {
14921504
map: A,

0 commit comments

Comments
 (0)