mirror of
https://github.com/nushell/nushell.git
synced 2025-08-19 10:03:24 +02:00
Follow API guidelines for public types (#12283)
# Description Follow the [API guideline naming conventions](https://rust-lang.github.io/api-guidelines/naming.html) also for our externally exposed types (See [`clippy::wrong_self_convention`](https://rust-lang.github.io/rust-clippy/master/index.html#/wrong_self_convention) with [`avoid-breaking-exported-api = false`](https://doc.rust-lang.org/clippy/lint_configuration.html#avoid-breaking-exported-api) ) Also be a good citizen around doccomments - **Fix `Unit::to_value` to `Unit::build_value`** - **Fix `PipelineData::is_external_failed` to `check_external_failed`** - **Fix doccomment on `check_external_failed`** - **Fix `Value::into_config` naming to `parse_as_config`** - **Document `Value::parse_as_config`** # Plugin-Author-Facing Changes See renames above
This commit is contained in:
committed by
GitHub
parent
e8bcfbaed1
commit
24d2c8dd8e
@@ -172,9 +172,16 @@ impl Default for Config {
|
||||
}
|
||||
|
||||
impl Value {
|
||||
pub fn into_config(&mut self, config: &Config) -> (Config, Option<ShellError>) {
|
||||
/// Parse the given [`Value`] as a configuration record, and recover encountered mistakes
|
||||
///
|
||||
/// If any given (sub)value is detected as impossible, this value will be restored to the value
|
||||
/// in `existing_config`, thus mutates `self`.
|
||||
///
|
||||
/// Returns a new [`Config`] (that is in a valid state) and if encountered the [`ShellError`]
|
||||
/// containing all observed inner errors.
|
||||
pub fn parse_as_config(&mut self, existing_config: &Config) -> (Config, Option<ShellError>) {
|
||||
// Clone the passed-in config rather than mutating it.
|
||||
let mut config = config.clone();
|
||||
let mut config = existing_config.clone();
|
||||
|
||||
// Vec for storing errors. Current Nushell behaviour (Dec 2022) is that having some typo
|
||||
// like `"always_trash": tru` in your config.nu's `$env.config` record shouldn't abort all
|
||||
|
Reference in New Issue
Block a user