Struct nu_engine::evaluation_context::EvaluationContext
source · [−]pub struct EvaluationContext {
pub scope: Scope,
pub engine_state: Arc<EngineState>,
}Fields
scope: Scopeengine_state: Arc<EngineState>Implementations
sourceimpl EvaluationContext
impl EvaluationContext
pub fn new(
scope: Scope,
host: Arc<Mutex<Box<dyn Host>>>,
current_errors: Arc<Mutex<Vec<ShellError>>>,
ctrl_c: Arc<AtomicBool>,
configs: Arc<Mutex<ConfigHolder>>,
shell_manager: ShellManager,
windows_drives_previous_cwd: Arc<Mutex<HashMap<String, String>>>
) -> Self
pub fn basic() -> EvaluationContext
pub fn error(&self, error: ShellError)
pub fn host(&self) -> &Arc<Mutex<Box<dyn Host>>>
pub fn current_errors(&self) -> &Arc<Mutex<Vec<ShellError>>>
pub fn ctrl_c(&self) -> &Arc<AtomicBool>
pub fn configs(&self) -> &Arc<Mutex<ConfigHolder>>
pub fn shell_manager(&self) -> &ShellManager
pub fn windows_drives_previous_cwd(
&self
) -> &Arc<Mutex<HashMap<String, String>>>
pub fn clear_errors(&self)
pub fn get_errors(&self) -> Vec<ShellError>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
pub fn configure<T>(
&mut self,
config: &dyn Conf,
block: impl FnOnce(&dyn Conf, &mut Self) -> T
)
pub fn with_host<T>(&self, block: impl FnOnce(&mut dyn Host) -> T) -> T
pub fn with_errors<T>(&self, block: impl FnOnce(&mut Vec<ShellError>) -> T) -> T
pub fn add_commands(&self, commands: Vec<Command>)
pub fn sync_path_to_env(&self)
pub fn get_command(&self, name: &str) -> Option<Command>
pub fn is_command_registered(&self, name: &str) -> bool
pub fn run_command(
&self,
command: Command,
name_tag: Tag,
args: Call,
input: InputStream
) -> Result<InputStream, ShellError>
sourcepub fn load_config(&self, cfg_path: &ConfigPath) -> Result<(), ShellError>
pub fn load_config(&self, cfg_path: &ConfigPath) -> Result<(), ShellError>
Loads config under cfg_path. If an error occurs while loading the config: The config is not loaded The error is returned After successful loading of the config the startup scripts are run as normal scripts (Errors are printed out, …) After executing the startup scripts, true is returned to indicate successful loading of the config
sourcepub fn reload_config(&self, cfg: &mut NuConfig) -> Result<(), ShellError>
pub fn reload_config(&self, cfg: &mut NuConfig) -> Result<(), ShellError>
Reloads config with a path of cfg_path. If an error occurs while reloading the config: The config is not reloaded The error is returned
sourcepub fn unload_config(&self, cfg_path: &ConfigPath)
pub fn unload_config(&self, cfg_path: &ConfigPath)
Runs all exit_scripts before unloading the config with path of cfg_path
If an error occurs while running exit scripts:
The error is added to self.current_errors
If no config with path of cfg_path is present, this method does nothing
Trait Implementations
sourceimpl Clone for EvaluationContext
impl Clone for EvaluationContext
sourcefn clone(&self) -> EvaluationContext
fn clone(&self) -> EvaluationContext
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Default for EvaluationContext
impl Default for EvaluationContext
sourcefn default() -> EvaluationContext
fn default() -> EvaluationContext
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl !RefUnwindSafe for EvaluationContext
impl Send for EvaluationContext
impl Sync for EvaluationContext
impl Unpin for EvaluationContext
impl !UnwindSafe for EvaluationContext
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> SpannedItem for T
impl<T> SpannedItem for T
sourceimpl<T> TaggedItem for T
impl<T> TaggedItem for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more