pub struct VariableStore {
pub profiles: BTreeMap<String, BTreeMap<String, String>>,
pub active_profile: String,
pub global: BTreeMap<String, String>,
}Expand description
A collection of user-defined variables, persisted as ~/.mur/variables.yaml.
Fields§
§profiles: BTreeMap<String, BTreeMap<String, String>>Named variable groups (e.g. “default”, “production”, “staging”)
active_profile: StringActive profile name
global: BTreeMap<String, String>Global variables (always available, overridden by profile)
Implementations§
Source§impl VariableStore
impl VariableStore
Sourcepub fn effective_vars(&self) -> BTreeMap<String, String>
pub fn effective_vars(&self) -> BTreeMap<String, String>
Get the effective variables: global merged with active profile. Profile values override global values.
Sourcepub fn set_global(&mut self, name: &str, value: &str)
pub fn set_global(&mut self, name: &str, value: &str)
Set a variable in global scope.
Sourcepub fn set_profile(&mut self, profile: &str, name: &str, value: &str)
pub fn set_profile(&mut self, profile: &str, name: &str, value: &str)
Set a variable in a specific profile.
Sourcepub fn remove_global(&mut self, name: &str) -> bool
pub fn remove_global(&mut self, name: &str) -> bool
Remove a variable from global scope.
Sourcepub fn remove_profile(&mut self, profile: &str, name: &str) -> bool
pub fn remove_profile(&mut self, profile: &str, name: &str) -> bool
Remove a variable from a specific profile.
Sourcepub fn switch_profile(&mut self, profile: &str)
pub fn switch_profile(&mut self, profile: &str)
Switch active profile.
Sourcepub fn profile_names(&self) -> Vec<&str>
pub fn profile_names(&self) -> Vec<&str>
List all profile names.
Trait Implementations§
Source§impl Clone for VariableStore
impl Clone for VariableStore
Source§fn clone(&self) -> VariableStore
fn clone(&self) -> VariableStore
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for VariableStore
impl Debug for VariableStore
Source§impl Default for VariableStore
impl Default for VariableStore
Source§fn default() -> VariableStore
fn default() -> VariableStore
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for VariableStore
impl<'de> Deserialize<'de> for VariableStore
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for VariableStore
impl RefUnwindSafe for VariableStore
impl Send for VariableStore
impl Sync for VariableStore
impl Unpin for VariableStore
impl UnsafeUnpin for VariableStore
impl UnwindSafe for VariableStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more