Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always delegate returning errors to the Visitor from Content[Ref]Deserializer #2811

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Commits on Oct 22, 2024

  1. Explain code in ContentDeserializer::deserialize_newtype_struct and a…

    …dd comments about coverage
    Mingun committed Oct 22, 2024
    Configuration menu
    Copy the full SHA
    397e871 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    90564e6 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    a1e4ce7 View commit details
    Browse the repository at this point in the history
  4. Remove confusing call to deserialize_untagged_variant in deserialize_…

    …internally_tagged_variant
    
    deserialize_untagged_variant in that place is called when deserialzie_with attribute is set.
    In that case it performs special actions that is better to use explicitly in deserialize_untagged_variant
    for readability
    Mingun committed Oct 22, 2024
    Configuration menu
    Copy the full SHA
    6929c5d View commit details
    Browse the repository at this point in the history
  5. Add test for sequence in newtype_unit

    failures(1):
        newtype_unit
    Mingun committed Oct 22, 2024
    Configuration menu
    Copy the full SHA
    ec5f590 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    bcffa60 View commit details
    Browse the repository at this point in the history
  7. Consistently use visit_content_seq and visit_content_map when deseria…

    …lize enums
    
    Helper methods visit_content_[seq|map] does the same as [Seq|Map]Deserializer::deserialize_any
    and used everywhere except here. Reuse them for consistency
    Mingun committed Oct 22, 2024
    Configuration menu
    Copy the full SHA
    5292da8 View commit details
    Browse the repository at this point in the history
  8. Deserializer should not check correctness of data, this is the respon…

    …sibility of the Visitor
    
    Examples of errors produced during deserialization of internally tagged enums in tests
    if instead of a Seq/Map a Str("unexpected string") will be provided:
    
    In tests/test_annotations.rs
      flatten::enum_::internally_tagged::tuple:
        before: `invalid type: string "unexpected string", expected tuple variant`
        after : `invalid type: string "unexpected string", expected tuple variant Enum::Tuple`
    
      flatten::enum_::internally_tagged::struct_from_map:
        before: `invalid type: string "unexpected string", expected struct variant`
        after : `invalid type: string "unexpected string", expected struct variant Enum::Struct`
    Mingun committed Oct 22, 2024
    Configuration menu
    Copy the full SHA
    9009f63 View commit details
    Browse the repository at this point in the history