nushell/crates/nu-engine/src/lib.rs
Ian Manske bae6d694ca
Refactor using ClosureEval types (#12541)
# Description
Adds two new types in `nu-engine` for evaluating closures: `ClosureEval`
and `ClosureEvalOnce`. This removed some duplicate code and centralizes
our logic for setting up, running, and cleaning up closures. For
example, in the future if we are able to reduce the cloning necessary to
run a closure, then we only have to change the code related to these
types.

`ClosureEval` and `ClosureEvalOnce` are designed with a builder API.
`ClosureEval` is used to run a closure multiple times whereas
`ClosureEvalOnce` is used for a one-shot closure.

# User-Facing Changes
Should be none, unless I messed up one of the command migrations.
Actually, this will fix any unreported environment bugs for commands
that didn't reset the env after running a closure.
2024-04-22 14:15:09 +08:00

23 lines
532 B
Rust

mod call_ext;
mod closure_eval;
pub mod column;
pub mod command_prelude;
pub mod documentation;
pub mod env;
mod eval;
mod eval_helpers;
mod glob_from;
pub mod scope;
pub use call_ext::CallExt;
pub use closure_eval::*;
pub use column::get_columns;
pub use documentation::get_full_help;
pub use env::*;
pub use eval::{
eval_block, eval_block_with_early_return, eval_call, eval_expression,
eval_expression_with_input, eval_subexpression, eval_variable, redirect_env,
};
pub use eval_helpers::*;
pub use glob_from::glob_from;