Skip to main content

EnvironmentStore

Struct EnvironmentStore 

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

In-memory storage for global and session-local environment values.

Implementations§

Source§

impl EnvironmentStore

Source

pub fn new() -> Self

Creates an empty environment store with no implicit defaults.

Source

pub fn is_empty(&self) -> bool

Returns whether neither global nor session-local values are present.

Source

pub fn set(&mut self, scope: ScopeSelector, name: String, value: String)

Stores the given visible value in the selected scope.

Source

pub fn set_with_flags( &mut self, scope: ScopeSelector, name: String, value: String, flags: u8, )

Stores the given value and flag word in the selected scope.

Source

pub fn clear(&mut self, scope: ScopeSelector, name: String)

Clears the selected variable, leaving a tombstone entry behind.

Source

pub fn unset(&mut self, scope: ScopeSelector, name: &str) -> bool

Removes the selected variable entirely.

Source

pub fn contains_entry(&self, scope: &ScopeSelector, name: &str) -> bool

Returns whether the exact entry exists in the selected scope.

Source

pub fn global_value(&self, name: &str) -> Option<&str>

Returns the exact global value for the given variable, when present and not cleared.

Source

pub fn global_entries(&self) -> impl Iterator<Item = (&str, &str)>

Returns all exact global environment entries in unspecified order.

Source

pub fn session_value( &self, session_name: &SessionName, name: &str, ) -> Option<&str>

Returns the exact session-local value for the given variable, when present and not cleared.

Source

pub fn resolve( &self, session_name: Option<&SessionName>, name: &str, ) -> Option<&str>

Resolves a single variable using session-local then global lookup.

Source

pub fn resolved(&self, session_name: &SessionName) -> HashMap<String, String>

Returns the visible explicit environment snapshot that future panes should inherit.

Source

pub fn apply_to_process_environment( &self, session_name: Option<&SessionName>, values: &mut HashMap<String, String>, )

Applies the selected scope chain to a process environment map.

Source

pub fn update( &mut self, session_name: &SessionName, patterns: &[String], source: &HashMap<String, String>, )

Merges client variables into a session environment using tmux update-environment.

Source

pub fn show_environment_entries( &self, scope: &ScopeSelector, hidden_only: bool, name: Option<&str>, ) -> Result<Vec<ShowEnvironmentEntry>, RmuxError>

Returns sorted show-environment entries for the selected global or session scope.

Source

pub fn remove_session( &mut self, session_name: &SessionName, ) -> Option<HashMap<String, String>>

Removes all session-local values for the given session.

Source

pub fn rename_session( &mut self, session_name: &SessionName, new_name: SessionName, ) -> Result<(), RmuxError>

Rekeys all session-local values from one validated session name to another.

Trait Implementations§

Source§

impl Clone for EnvironmentStore

Source§

fn clone(&self) -> EnvironmentStore

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EnvironmentStore

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for EnvironmentStore

Source§

fn default() -> EnvironmentStore

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

impl PartialEq for EnvironmentStore

Source§

fn eq(&self, other: &EnvironmentStore) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for EnvironmentStore

Source§

impl StructuralPartialEq for EnvironmentStore

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.