pub struct EnvironmentStore { /* private fields */ }Expand description
In-memory storage for global and session-local environment values.
Implementations§
Source§impl EnvironmentStore
impl EnvironmentStore
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns whether neither global nor session-local values are present.
Sourcepub fn set(&mut self, scope: ScopeSelector, name: String, value: String)
pub fn set(&mut self, scope: ScopeSelector, name: String, value: String)
Stores the given visible value in the selected scope.
Sourcepub fn set_with_flags(
&mut self,
scope: ScopeSelector,
name: String,
value: String,
flags: u8,
)
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.
Sourcepub fn set_implicit_global(&mut self, name: String, value: String)
pub fn set_implicit_global(&mut self, name: String, value: String)
Stores an implicit global value captured from the server environment.
Sourcepub fn set_implicit_global_display(&mut self, name: String, value: String)
pub fn set_implicit_global_display(&mut self, name: String, value: String)
Stores an implicit global value that is only renderable by show-environment.
Sourcepub fn clear(&mut self, scope: ScopeSelector, name: String)
pub fn clear(&mut self, scope: ScopeSelector, name: String)
Clears the selected variable, leaving a tombstone entry behind.
Sourcepub fn unset(&mut self, scope: ScopeSelector, name: &str) -> bool
pub fn unset(&mut self, scope: ScopeSelector, name: &str) -> bool
Removes the selected variable entirely.
Sourcepub fn contains_entry(&self, scope: &ScopeSelector, name: &str) -> bool
pub fn contains_entry(&self, scope: &ScopeSelector, name: &str) -> bool
Returns whether the exact entry exists in the selected scope.
Sourcepub fn global_value(&self, name: &str) -> Option<&str>
pub fn global_value(&self, name: &str) -> Option<&str>
Returns the exact global value for the given variable, when present and not cleared.
Sourcepub fn global_entries(&self) -> impl Iterator<Item = (&str, &str)>
pub fn global_entries(&self) -> impl Iterator<Item = (&str, &str)>
Returns all exact global environment entries in unspecified order.
Sourcepub fn session_value(
&self,
session_name: &SessionName,
name: &str,
) -> Option<&str>
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.
Sourcepub fn resolve(
&self,
session_name: Option<&SessionName>,
name: &str,
) -> Option<&str>
pub fn resolve( &self, session_name: Option<&SessionName>, name: &str, ) -> Option<&str>
Resolves a single variable using session-local then global lookup.
Sourcepub fn resolved(&self, session_name: &SessionName) -> HashMap<String, String>
pub fn resolved(&self, session_name: &SessionName) -> HashMap<String, String>
Returns the visible explicit environment snapshot that future panes should inherit.
Sourcepub fn apply_to_process_environment(
&self,
session_name: Option<&SessionName>,
values: &mut HashMap<String, String>,
)
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.
Sourcepub fn apply_to_process_environment_without_implicit_globals(
&self,
session_name: Option<&SessionName>,
values: &mut HashMap<String, String>,
)
pub fn apply_to_process_environment_without_implicit_globals( &self, session_name: Option<&SessionName>, values: &mut HashMap<String, String>, )
Applies explicit values only, skipping implicit globals captured from the server process.
Sourcepub fn suppressed_process_environment_names(
&self,
session_name: Option<&SessionName>,
include_implicit_globals: bool,
) -> HashSet<String>
pub fn suppressed_process_environment_names( &self, session_name: Option<&SessionName>, include_implicit_globals: bool, ) -> HashSet<String>
Returns names that must be removed from raw process environments.
Sourcepub fn update(
&mut self,
session_name: &SessionName,
patterns: &[String],
source: &HashMap<String, String>,
)
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.
Sourcepub fn show_environment_entries(
&self,
scope: &ScopeSelector,
hidden_only: bool,
name: Option<&str>,
) -> Result<Vec<ShowEnvironmentEntry>, RmuxError>
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.
Sourcepub fn remove_session(
&mut self,
session_name: &SessionName,
) -> Option<HashMap<String, String>>
pub fn remove_session( &mut self, session_name: &SessionName, ) -> Option<HashMap<String, String>>
Removes all session-local values for the given session.
Sourcepub fn rename_session(
&mut self,
session_name: &SessionName,
new_name: SessionName,
) -> Result<(), RmuxError>
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
impl Clone for EnvironmentStore
Source§fn clone(&self) -> EnvironmentStore
fn clone(&self) -> EnvironmentStore
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more