Repository navigation
Construct Records only through checked helpers - #11386
Merged
Merged
Conversation
This can probably be refactored to `FromIterator` as most are direclty collected above. (this would be future proof)
Use `.collect` for capacity optimization and lift length check before the evaluation.
sholderbach
added a commit
to sholderbach/nushell
that referenced
this pull request
Dec 24, 2023
With nushell#11386 we don't have any nushell-internal code directly accessing the `vals` field of `Record`, so let's make it private so everyone in the future uses the checked ways guaranteeing matching cols/vals. The `cols` feel has to remain pub for now as `rename` still directly mutates this field. See nushell#11020 for challenges for this refactor. This is a breaking change for outside plugins that relied on the pub fields.
sholderbach
added a commit
that referenced
this pull request
Dec 24, 2023
# Description With #11386 we don't have any nushell-internal code directly accessing the `vals` field of `Record`, so let's make it private so everyone in the future uses the checked ways guaranteeing matching cols/vals. The `cols` feel has to remain pub for now as `rename` still directly mutates this field. See #11020 for challenges for this refactor. # Plugin-Author-Facing Changes This is a breaking change for outside plugins that relied on the `pub` fields.
dmatos2012
pushed a commit
to dmatos2012/nushell
that referenced
this pull request
Feb 20, 2024
# Description Constructing the internals of `Record` without checking the lengths is bad. (also incompatible with changes to how we store records) - Use `Record::from_raw_cols_vals` in dataframe code - Use `record!` macro in dataframe test - Use `record!` in `nu-color-config` tests - Stop direct record construction in `nu-command` - Refactor table construction in `from nuon` # User-Facing Changes None # Tests + Formatting No new tests, updated tests in equal fashion
dmatos2012
pushed a commit
to dmatos2012/nushell
that referenced
this pull request
Feb 20, 2024
# Description With nushell#11386 we don't have any nushell-internal code directly accessing the `vals` field of `Record`, so let's make it private so everyone in the future uses the checked ways guaranteeing matching cols/vals. The `cols` feel has to remain pub for now as `rename` still directly mutates this field. See nushell#11020 for challenges for this refactor. # Plugin-Author-Facing Changes This is a breaking change for outside plugins that relied on the `pub` fields.
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
Constructing the internals of
Recordwithout checking the lengths is bad. (also incompatible with changes to how we store records)Record::from_raw_cols_valsin dataframe coderecord!macro in dataframe testrecord!innu-color-configtestsnu-commandfrom nuonUser-Facing Changes
None
Tests + Formatting
No new tests, updated tests in equal fashion