Lock out new direct construction of Record (#11414)

# 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.
This commit is contained in:
Stefan Holderbach 2023-12-24 13:12:16 +01:00 committed by GitHub
parent b0b4c3dffd
commit c1cc1c82cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,8 +6,12 @@ use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct Record {
/// Don't use this field publicly!
///
/// Only public as command `rename` is not reimplemented in a sane way yet
/// Using it or making `vals` public will draw shaming by @sholderbach
pub cols: Vec<String>,
pub vals: Vec<Value>,
vals: Vec<Value>,
}
impl Record {