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

Fix nested arrays (by reworking array handling) - backport #486

Merged

Commits on Nov 7, 2023

  1. ser: sequences: Centralise

    Have all the various versions of sequences (arrays and various forms
    of tuple) all go via ser::SerializeSeq.
    
    This reduces some duplication.  And, we're about to change the
    implementation.
    
    Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
    (cherry picked from commit ed6a3c9)
    Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
    ijackson committed Nov 7, 2023
    Configuration menu
    Copy the full SHA
    319a9e2 View commit details
    Browse the repository at this point in the history
  2. ser: sequences: Introduce SeqSerializer newtype

    We're going to want to do something more complicated.
    
    In particular, to handle nested arrays properly, we need to do some
    work at the start and end of each array.
    
    The `new` and (inherent) `end` methods of this newtype is where that
    work will be done.
    
    Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
    (cherry picked from commit 147e6c7)
    Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
    ijackson committed Nov 7, 2023
    Configuration menu
    Copy the full SHA
    43ac661 View commit details
    Browse the repository at this point in the history
  3. ser: sequences: Rework, fixing handling of nested arrays

    Change the representation of our "current location".  Previously it
    was a list of increasingly-long full paths, but excepting the putative
    final array index.
    
    Now we just record the individual elements. and assemble the whole
    path just before calling .set().  This saves a little memory on the
    whole since the entries in keys are now a bit shorter.
    
    It is much less confusing.  (There are perhaps still further
    opportunities to use Rust's type system to better advantage to
    eliminuate opportunities for bugs.)
    
    Arrays that appear other than at the top level are now handled
    correctly.  This includes nested arrays, and arrays containing
    structs, etc.
    
    Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
    (cherry picked from commit 831102f)
    Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
    ijackson committed Nov 7, 2023
    Configuration menu
    Copy the full SHA
    9bed600 View commit details
    Browse the repository at this point in the history
  4. ser: sequences: Test a more comprehensive round-trip

    Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
    (cherry picked from commit aa63d2d)
    Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
    ijackson committed Nov 7, 2023
    Configuration menu
    Copy the full SHA
    eb46fd6 View commit details
    Browse the repository at this point in the history