Add support for math-like externals (#4606)

This commit is contained in:
JT
2022-02-22 10:55:28 -05:00
committed by GitHub
parent d054a724d1
commit 25712760ba
7 changed files with 63 additions and 4 deletions

View File

@ -169,6 +169,9 @@ pub struct EngineState {
pub env_vars: im::HashMap<String, Value>,
#[cfg(feature = "plugin")]
pub plugin_signatures: Option<PathBuf>,
// A list of external commands that look like math expressions
pub external_exceptions: Vec<Vec<u8>>,
}
pub const NU_VARIABLE_ID: usize = 0;
@ -199,6 +202,7 @@ impl EngineState {
env_vars: im::HashMap::new(),
#[cfg(feature = "plugin")]
plugin_signatures: None,
external_exceptions: vec![],
}
}
@ -633,6 +637,7 @@ impl Default for EngineState {
pub struct StateWorkingSet<'a> {
pub permanent_state: &'a EngineState,
pub delta: StateDelta,
pub external_commands: Vec<Vec<u8>>,
}
/// A delta (or change set) between the current global state and a possible future global state. Deltas
@ -707,6 +712,7 @@ impl<'a> StateWorkingSet<'a> {
Self {
delta: StateDelta::new(),
permanent_state,
external_commands: vec![],
}
}