Skip to content
Myr

Improve wording of PR 2805 comments

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

authored by David Tolnay · committed by David Tolnay · parent 87a2fb0 · Browse files · 1 file+16 added−12 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+16 added−12 removed

  • other:+16 added−12 removed

1 file+16 added−12 removed

modified:serde/src/private/de.rs+16 added-12 removed
1902 unmodified lines
1903 match *self.content {1904 Content::None => visitor.visit_none(),1905 Content::Some(ref v) => visitor.visit_some(ContentRefDeserializer::new(v)),1906 Content::Unit => visitor.visit_unit(),1907 // This case is necessary for formats which does not store1908 // marker of optionality of value, for example, JSON. When1909 // `deserialize_any` is requested from such formats, they will1910 // report value without using `Visitor::visit_some`, because1911 // they do not known in which contexts this value will be used.1912 // RON is example of format which preserve markers.1907 // This case is to support data formats which do not encode an1908 // indication whether a value is optional. An example of such a1909 // format is JSON, and a counterexample is RON. When requesting1910 // `deserialize_any` in JSON, the data format never performs1911 // `Visitor::visit_some` but we still must be able to1912 // deserialize the resulting Content into data structures with1913 // optional fields.1914 _ => visitor.visit_some(self),1915 }1916 }1917
27 unmodified lines
1945 match *self.content {1946 Content::Newtype(ref v) => {1947 visitor.visit_newtype_struct(ContentRefDeserializer::new(v))1948 }1948 // This case is necessary for formats which does not store1949 // marker of a newtype, for example, JSON. When1950 // `deserialize_any` is requested from such formats, they will1951 // report value without using `Visitor::visit_newtype_struct`,1952 // because they do not known in which contexts this value will1953 // be used. RON is example of format which preserve markers.1949 // This case is to support data formats that encode newtype1950 // structs and their underlying data the same, with no1951 // indication whether a newtype wrapper was present. For example1952 // JSON does this, while RON does not. In RON a newtype's name1953 // is included in the serialized representation and it knows to1954 // call `Visitor::visit_newtype_struct` from `deserialize_any`.1955 // JSON's `deserialize_any` never calls `visit_newtype_struct`1956 // but in this code we still must be able to deserialize the1957 // resulting Content into newtypes.1958 _ => visitor.visit_newtype_struct(self),1959 }1960 }1961
834 unmodified lines