mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 03:34:58 +02:00
Use Vec
for Closure
captures (#10940)
# Description Changes the `captures` field in `Closure` from a `HashMap` to a `Vec` and makes `Stack::captures_to_stack` take an owned `Vec` instead of a borrowed `HashMap`. This eliminates the conversion to a `Vec` inside `captures_to_stack` and makes it possible to avoid clones altogether when using an owned `Closure` (which is the case for most commands). Additionally, using a `Vec` reduces the size of `Value` by 8 bytes (down to 72). # User-Facing Changes Breaking API change for `nu-protocol`.
This commit is contained in:
@ -102,7 +102,7 @@ used as the next argument to the closure, otherwise generation stops.
|
||||
let block = engine_state.get_block(capture_block.item.block_id).clone();
|
||||
let ctrlc = engine_state.ctrlc.clone();
|
||||
let engine_state = engine_state.clone();
|
||||
let mut stack = stack.captures_to_stack(&capture_block.item.captures);
|
||||
let mut stack = stack.captures_to_stack(capture_block.item.captures);
|
||||
let orig_env_vars = stack.env_vars.clone();
|
||||
let orig_env_hidden = stack.env_hidden.clone();
|
||||
let redirect_stdout = call.redirect_stdout;
|
||||
|
@ -114,7 +114,7 @@ used as the next argument to the closure, otherwise generation stops.
|
||||
let block = engine_state.get_block(capture_block.item.block_id).clone();
|
||||
let ctrlc = engine_state.ctrlc.clone();
|
||||
let engine_state = engine_state.clone();
|
||||
let mut stack = stack.captures_to_stack(&capture_block.item.captures);
|
||||
let mut stack = stack.captures_to_stack(capture_block.item.captures);
|
||||
let orig_env_vars = stack.env_vars.clone();
|
||||
let orig_env_hidden = stack.env_hidden.clone();
|
||||
let redirect_stdout = call.redirect_stdout;
|
||||
|
Reference in New Issue
Block a user