Skip to main content

ShellState

Trait ShellState 

Source
pub trait ShellState {
Show 36 methods // Required methods fn is_subshell(&self) -> bool; fn last_stopwatch_time(&self) -> SystemTime; fn last_stopwatch_offset(&self) -> u32; fn env(&self) -> &ShellEnvironment; fn env_mut(&mut self) -> &mut ShellEnvironment; fn options(&self) -> &RuntimeOptions; fn options_mut(&mut self) -> &mut RuntimeOptions; fn aliases(&self) -> &HashMap<String, String>; fn aliases_mut(&mut self) -> &mut HashMap<String, String>; fn jobs(&self) -> &JobManager; fn jobs_mut(&mut self) -> &mut JobManager; fn traps(&self) -> &TrapHandlerConfig; fn traps_mut(&mut self) -> &mut TrapHandlerConfig; fn directory_stack(&self) -> &[PathBuf]; fn directory_stack_mut(&mut self) -> &mut Vec<PathBuf>; fn last_pipeline_statuses(&self) -> &[u8] ; fn last_pipeline_statuses_mut(&mut self) -> &mut Vec<u8> ; fn program_location_cache(&self) -> &PathCache; fn program_location_cache_mut(&mut self) -> &mut PathCache; fn completion_config(&self) -> &Config; fn completion_config_mut(&mut self) -> &mut Config; fn open_files(&self) -> &OpenFiles; fn open_files_mut(&mut self) -> &mut OpenFiles; fn current_shell_name(&self) -> Option<Cow<'_, str>>; fn depth(&self) -> usize; fn call_stack(&self) -> &CallStack; fn history(&self) -> Option<&History>; fn history_mut(&mut self) -> Option<&mut History>; fn version(&self) -> Option<&str>; fn last_exit_status(&self) -> u8; fn set_last_exit_status(&mut self, status: u8); fn key_bindings(&self) -> Option<&Arc<Mutex<dyn KeyBindings>>>; fn set_key_bindings( &mut self, key_bindings: Option<Arc<Mutex<dyn KeyBindings>>>, ); fn working_dir(&self) -> &Path; fn working_dir_mut(&mut self) -> &mut PathBuf; fn product_display_str(&self) -> Option<&str>;
}
Expand description

A dyn-safe trait for constrained access to shell state.

Required Methods§

Source

fn is_subshell(&self) -> bool

Returns whether or not this shell is a subshell.

Source

fn last_stopwatch_time(&self) -> SystemTime

Returns the last “SECONDS” captured time.

Source

fn last_stopwatch_offset(&self) -> u32

Returns the last “SECONDS” offset requested.

Source

fn env(&self) -> &ShellEnvironment

Returns the shell environment containing variables.

Source

fn env_mut(&mut self) -> &mut ShellEnvironment

Returns a mutable reference to the shell environment.

Source

fn options(&self) -> &RuntimeOptions

Returns the shell’s runtime options.

Source

fn options_mut(&mut self) -> &mut RuntimeOptions

Returns a mutable reference to the shell’s runtime options.

Source

fn aliases(&self) -> &HashMap<String, String>

Returns the shell’s aliases.

Source

fn aliases_mut(&mut self) -> &mut HashMap<String, String>

Returns a mutable reference to the shell’s aliases.

Source

fn jobs(&self) -> &JobManager

Returns the shell’s job manager.

Source

fn jobs_mut(&mut self) -> &mut JobManager

Returns a mutable reference to the shell’s job manager.

Source

fn traps(&self) -> &TrapHandlerConfig

Returns the shell’s trap handler configuration.

Source

fn traps_mut(&mut self) -> &mut TrapHandlerConfig

Returns a mutable reference to the shell’s trap handler configuration.

Source

fn directory_stack(&self) -> &[PathBuf]

Returns the shell’s directory stack.

Source

fn directory_stack_mut(&mut self) -> &mut Vec<PathBuf>

Returns a mutable reference to the shell’s directory stack.

Source

fn last_pipeline_statuses(&self) -> &[u8]

Returns the statuses of commands in the last pipeline.

Source

fn last_pipeline_statuses_mut(&mut self) -> &mut Vec<u8>

Returns a mutable reference to the statuses of commands in the last pipeline.

Source

fn program_location_cache(&self) -> &PathCache

Returns the shell’s program location cache.

Source

fn program_location_cache_mut(&mut self) -> &mut PathCache

Returns a mutable reference to the shell’s program location cache.

Source

fn completion_config(&self) -> &Config

Returns the shell’s completion configuration.

Source

fn completion_config_mut(&mut self) -> &mut Config

Returns a mutable reference to the shell’s completion configuration.

Source

fn open_files(&self) -> &OpenFiles

Returns the shell’s open files.

Source

fn open_files_mut(&mut self) -> &mut OpenFiles

Returns a mutable reference to the shell’s open files.

Source

fn current_shell_name(&self) -> Option<Cow<'_, str>>

Returns the current name of the shell ($0).

Source

fn depth(&self) -> usize

Returns the current subshell depth; 0 is returned if this shell is not a subshell.

Source

fn call_stack(&self) -> &CallStack

Returns the call stack for the shell.

Source

fn history(&self) -> Option<&History>

Returns the shell’s history, if it exists.

Source

fn history_mut(&mut self) -> Option<&mut History>

Returns a mutable reference to the shell’s history, if it exists.

Source

fn version(&self) -> Option<&str>

Returns the shell’s official version string (if available).

Source

fn last_exit_status(&self) -> u8

Returns the exit status of the last command executed in this shell.

Source

fn set_last_exit_status(&mut self, status: u8)

Updates the last exit status.

Source

fn key_bindings(&self) -> Option<&Arc<Mutex<dyn KeyBindings>>>

Returns the key bindings helper for the shell.

Source

fn set_key_bindings( &mut self, key_bindings: Option<Arc<Mutex<dyn KeyBindings>>>, )

Sets the key bindings helper for the shell.

Source

fn working_dir(&self) -> &Path

Returns the shell’s current working directory.

Source

fn working_dir_mut(&mut self) -> &mut PathBuf

Returns a mutable reference to the shell’s current working directory. This is only accessible within the crate.

Source

fn product_display_str(&self) -> Option<&str>

Returns the product display name for this shell.

Implementors§