fix(autoconfigure): apply the actions properly in the root

This commit is contained in:
2025-10-27 03:37:09 -04:00
parent facd2000a5
commit 1799419bfa
22 changed files with 79 additions and 38 deletions

View File

@@ -83,6 +83,11 @@ impl SproutContext {
self.root.as_ref()
}
/// Access the root context to modify it, if possible.
pub fn root_mut(&mut self) -> Option<&mut RootContext> {
Rc::get_mut(&mut self.root)
}
/// Retrieve the value specified by `key` from this context or its parents.
/// Returns `None` if the value is not found.
pub fn get(&self, key: impl AsRef<str>) -> Option<&String> {
@@ -235,4 +240,10 @@ impl SproutContext {
pub fn stamp(&self, text: impl AsRef<str>) -> String {
Self::stamp_values(&self.all_values(), text.as_ref()).1
}
/// Unloads a [SproutContext] back into an owned context. This
/// may not succeed if something else is holding onto the value.
pub fn unload(self: Rc<SproutContext>) -> Option<SproutContext> {
Rc::into_inner(self)
}
}