mirror of
https://github.com/nushell/nushell.git
synced 2025-05-08 12:04:25 +02:00
We split off the evaluation engine part of nu-cli into its own crate. This helps improve build times for nu-cli by 17% in my tests. It also helps us see a bit better what's the core engine portion vs the part specific to the interactive CLI piece. There's more than can be done here, but I think it's a good start in the right direction.
31 lines
632 B
Rust
31 lines
632 B
Rust
use nu_protocol::Value;
|
|
use std::ffi::OsString;
|
|
|
|
use std::fmt::Debug;
|
|
|
|
pub trait Env: Debug + Send {
|
|
fn env(&self) -> Option<Value>;
|
|
fn path(&self) -> Option<Value>;
|
|
|
|
fn add_env(&mut self, key: &str, value: &str);
|
|
fn add_path(&mut self, new_path: OsString);
|
|
}
|
|
|
|
impl Env for Box<dyn Env> {
|
|
fn env(&self) -> Option<Value> {
|
|
(**self).env()
|
|
}
|
|
|
|
fn path(&self) -> Option<Value> {
|
|
(**self).path()
|
|
}
|
|
|
|
fn add_env(&mut self, key: &str, value: &str) {
|
|
(**self).add_env(key, value);
|
|
}
|
|
|
|
fn add_path(&mut self, new_path: OsString) {
|
|
(**self).add_path(new_path);
|
|
}
|
|
}
|