mirror of
https://github.com/nushell/nushell.git
synced 2025-02-18 03:21:05 +01:00
# 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`.
15 lines
285 B
Rust
15 lines
285 B
Rust
use crate::{BlockId, Value, VarId};
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
|
pub struct Closure {
|
|
pub block_id: BlockId,
|
|
pub captures: Vec<(VarId, Value)>,
|
|
}
|
|
|
|
#[derive(Clone, Debug)]
|
|
pub struct Block {
|
|
pub block_id: BlockId,
|
|
}
|