Skip to main content

GlobalState

Struct GlobalState 

Source
pub struct GlobalState { /* private fields */ }
Expand description

Global state for the command-stream library

Implementations§

Source§

impl GlobalState

Source

pub fn new() -> Self

Create a new global state

Source

pub async fn get_shell_settings(&self) -> ShellSettings

Get the current shell settings

Source

pub async fn set_shell_settings(&self, settings: ShellSettings)

Set shell settings

Source

pub async fn with_shell_settings<F>(&self, f: F)
where F: FnOnce(&mut ShellSettings),

Modify shell settings with a closure

Source

pub async fn enable_shell_option(&self, option: &str)

Enable a shell option

Source

pub async fn disable_shell_option(&self, option: &str)

Disable a shell option

Source

pub async fn register_runner(&self) -> u64

Register a new active runner and return its ID

Source

pub async fn unregister_runner(&self, id: u64)

Unregister an active runner

Source

pub async fn active_runner_count(&self) -> usize

Get the count of active runners

Source

pub fn are_signal_handlers_installed(&self) -> bool

Check if signal handlers are installed

Source

pub fn set_signal_handlers_installed(&self, installed: bool)

Mark signal handlers as installed

Source

pub fn are_virtual_commands_enabled(&self) -> bool

Check if virtual commands are enabled

Source

pub fn enable_virtual_commands(&self)

Enable virtual commands

Source

pub fn disable_virtual_commands(&self)

Disable virtual commands

Source

pub async fn get_initial_cwd(&self) -> Option<PathBuf>

Get the initial working directory

Source

pub async fn reset(&self)

Reset global state to defaults

Source

pub async fn restore_cwd(&self) -> Result<()>

Restore working directory to initial

Trait Implementations§

Source§

impl Default for GlobalState

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.