pub struct Context<K, V> { /* private fields */ }
Expand description
A module with a path to an open submodule.
Implementations§
Source§impl<K: Ord, V: Default> Context<K, V>
impl<K: Ord, V: Default> Context<K, V>
Sourcepub fn open_or_default(&mut self, name: K)
pub fn open_or_default(&mut self, name: K)
Open a default module inside the previously open module.
Source§impl<K: Ord, V> Context<K, V>
impl<K: Ord, V> Context<K, V>
Sourcepub fn open_or(&mut self, name: K, module: Module<K, V>)
pub fn open_or(&mut self, name: K, module: Module<K, V>)
Open a module inside the previously open module.
Use the provided module if the module with the given name does not exist.
Sourcepub fn open_or_else(&mut self, name: K, f: impl FnOnce() -> Module<K, V>)
pub fn open_or_else(&mut self, name: K, f: impl FnOnce() -> Module<K, V>)
Open a module inside the previously open module.
Use the provided closure if the module with the given name does not exist.
Sourcepub fn insert(&mut self, name: K, module: Module<K, V>) -> Option<Module<K, V>>
pub fn insert(&mut self, name: K, module: Module<K, V>) -> Option<Module<K, V>>
Insert a module into the currently open module.
Sourcepub fn remove(&mut self, name: &K) -> Option<Module<K, V>>
pub fn remove(&mut self, name: &K) -> Option<Module<K, V>>
Remove a module from the currently open module.
Trait Implementations§
Auto Trait Implementations§
impl<K, V> Freeze for Context<K, V>where
V: Freeze,
impl<K, V> RefUnwindSafe for Context<K, V>where
V: RefUnwindSafe,
K: RefUnwindSafe,
impl<K, V> Send for Context<K, V>
impl<K, V> Sync for Context<K, V>
impl<K, V> Unpin for Context<K, V>
impl<K, V> UnwindSafe for Context<K, V>
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