Skip to content
Myr

Merge pull request #2714 from Marcono1234/skipped-field-struct-len

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Document that `len` does not include skipped struct fields

authored by David Tolnay · committed by GitHub · parents 3f43fca, eae7c2d · Browse files · 1 file+8 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+8 added−1 removed

  • other:+8 added−1 removed

1 file+8 added−1 removed

modified:serde/src/ser/mod.rs+8 added-1 removed
1168 unmodified lines
1169 /// This call must be followed by zero or more calls to `serialize_field`,1170 /// then a call to `end`.1171 ///1172 /// The `name` is the name of the struct and the `len` is the number of1173 /// data fields that will be serialized.1173 /// data fields that will be serialized. `len` does not include fields1174 /// which are skipped with [`SerializeStruct::skip_field`].1175 ///1176 /// ```edition20211177 /// use serde::ser::{Serialize, SerializeStruct, Serializer};1178 ///
28 unmodified lines
1207 ///1208 /// The `name` is the name of the enum, the `variant_index` is the index of1209 /// this variant within the enum, the `variant` is the name of the variant,1210 /// and the `len` is the number of data fields that will be serialized.1211 /// `len` does not include fields which are skipped with1212 /// [`SerializeStructVariant::skip_field`].1213 ///1214 /// ```edition20211215 /// use serde::ser::{Serialize, SerializeStructVariant, Serializer};1216 ///
642 unmodified lines
1859 where1860 T: ?Sized + Serialize;18611862 /// Indicate that a struct field has been skipped.1863 ///1864 /// The default implementation does nothing.1865 #[inline]1866 fn skip_field(&mut self, key: &'static str) -> Result<(), Self::Error> {1867 let _ = key;1868 Ok(())
54 unmodified lines
1923 where1924 T: ?Sized + Serialize;19251926 /// Indicate that a struct variant field has been skipped.1927 ///1928 /// The default implementation does nothing.1929 #[inline]1930 fn skip_field(&mut self, key: &'static str) -> Result<(), Self::Error> {1931 let _ = key;1932 Ok(())
15 unmodified lines