Repository navigation
Implement De-/Serialize for Record manually - #12365
Merged
Merged
Conversation
This decouples the serialized representation of `Record` from its internal implementation. It now gets treated as a map type in `serde`. This has several benefits: - more efficient representation (not showing inner fields) - human readable e.g. as a JSON record - no breaking changes when refactoring the `Record` internals in the future (see nushell#12326, or potential introduction of `indexmap::IndexMap` for large N) - we now deny the creation of invalid records a non-cooperating plugin could produce - guaranteed key-value correspondence - checking for unique keys
Lay out the format, check the unique property
Contributor
|
Are we waiting on anything for this? I want to document the serialized format of all |
Contributor
I don't think so, it's just because no one has looked into it yet. |
WindSoilder
approved these changes
Apr 6, 2024
WindSoilder
left a comment
Contributor
There was a problem hiding this comment.
Thank! Let's land and try it out
Contributor
|
Thanks @WindSoilder ❤️ |
FilipAndersson245
pushed a commit
to FilipAndersson245/nushell
that referenced
this pull request
Apr 10, 2024
# Description This decouples the serialized representation of `Record` from its internal implementation. It now gets treated as a map type in `serde`. This has several benefits: - more efficient representation (not showing inner fields) - human readable e.g. as a JSON record - no breaking changes when refactoring the `Record` internals in the future (see nushell#12326, or potential introduction of `indexmap::IndexMap` for large N) - we now deny the creation of invalid records a non-cooperating plugin could produce - guaranteed key-value correspondence - checking for unique keys # Breaking change to the plugin protocol: Now expects a record/map directly as the `Record.val` field instead of a serialization of it.
NotTheDr01ds
pushed a commit
to NotTheDr01ds/nushell
that referenced
this pull request
Apr 12, 2024
# Description This decouples the serialized representation of `Record` from its internal implementation. It now gets treated as a map type in `serde`. This has several benefits: - more efficient representation (not showing inner fields) - human readable e.g. as a JSON record - no breaking changes when refactoring the `Record` internals in the future (see nushell#12326, or potential introduction of `indexmap::IndexMap` for large N) - we now deny the creation of invalid records a non-cooperating plugin could produce - guaranteed key-value correspondence - checking for unique keys # Breaking change to the plugin protocol: Now expects a record/map directly as the `Record.val` field instead of a serialization of it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This decouples the serialized representation of
Recordfrom its internal implementation. It now gets treated as a map type inserde.This has several benefits:
Recordinternals in the future (see RefactorRecordto use a single backingVec#12326, or potential introduction ofindexmap::IndexMapfor large N)Breaking change to the plugin protocol:
Now expects a record/map directly as the
Record.valfield instead of a serialization of it.