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 seal and unseal of nested and recursive structures, strings (char slices) #4

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

Conversation

DomKalinowski
Copy link

@DomKalinowski DomKalinowski commented Sep 30, 2024

This commit will enable serializing and deserializing nested structures by fixing how variant_ptr gets initialized.

I also added new test cases to ensure all my use cases would be covered by this library:

  • compact union with string field
  • seal and unseal with buffer:
    • union with string field
    • structure with enum field
    • structure with an optional slice of structures
    • recursive structure
    • complex recursive union

For all seal and unseal new tests I used std.testing.allocator to detect any memory leaks.

And renamed value to value_ptr across the repair function and updated related references to improve reasoning about the value.

Updated `field.field_type` to `field.type` for better consistency with Zig's type system.

Replaced `@ptrCast` with `@as` for pointer conversions and added `const` qualifiers where applicable.

Modified test cases to reflect these changes and ensure correctness.

This refactoring aligns the code with current current stable (0.13.0) version without altering functionality.
… slices)

This commit will enable serializing and deserializing nested structures by fixing how variant_ptr gets initialized.

I also added new test cases to ensure all my use cases would be covered by this library:
- compact union with string field
- seal and unseal with buffer:
   - union with string field
   - structure with enum field
   - structure with an optional slice of structures
   - recursive structure
   - complex recursive union

And renamed `value` to `value_ptr` across the `repair` function and updated related references to imporve reasoning about the value.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant