[−][src]Struct nested_modules::Context
A module with a path to an open submodule.
Implementations
impl<K: Ord, V: Default> Context<K, V>
[src]
pub fn new() -> Self
[src]
Create a new context with a default root module as current open module.
pub fn open_or_default(&mut self, name: K)
[src]
Open a default module inside the previously open module.
impl<K: Ord, V> Context<K, V>
[src]
pub fn open_or(&mut self, name: K, module: Module<K, V>)
[src]
Open a module inside the previously open module.
Use the provided module if the module with the given name does not exist.
pub fn open_or_else(&mut self, name: K, f: impl FnOnce() -> Module<K, V>)
[src]
Open a module inside the previously open module.
Use the provided closure if the module with the given name does not exist.
pub fn insert(&mut self, name: K, module: Module<K, V>) -> Option<Module<K, V>>
[src]
Insert a module into the currently open module.
pub fn remove(&mut self, name: &K) -> Option<Module<K, V>>
[src]
Remove a module from the currently open module.
pub fn close(&mut self) -> bool
[src]
Close the currently open module.
Return false if the current open module is the root module.
pub fn find<'a>(
&'a self,
path: &'a [K]
) -> impl Iterator<Item = &'a Module<K, V>>
[src]
&'a self,
path: &'a [K]
) -> impl Iterator<Item = &'a Module<K, V>>
Find modules matching the given path from the currently open module.
impl<K, V> Context<K, V>
[src]
pub fn get(&self) -> &Module<K, V>
[src]
Return a reference to the currently open module.
pub fn get_mut(&mut self) -> &mut Module<K, V>
[src]
Return a mutable reference to the currently open module.
pub fn get_path(&self) -> impl Iterator<Item = &K>
[src]
Return the path of the currently open module.
Trait Implementations
impl<K: Ord, V: Default> Default for Context<K, V>
[src]
impl<K: Ord, V> From<Context<K, V>> for Module<K, V>
[src]
impl<K, V> From<Module<K, V>> for Context<K, V>
[src]
Auto Trait Implementations
impl<K, V> Send for Context<K, V> where
K: Send,
V: Send,
K: Send,
V: Send,
impl<K, V> Sync for Context<K, V> where
K: Sync,
V: Sync,
K: Sync,
V: Sync,
impl<K, V> Unpin for Context<K, V> where
K: Unpin,
V: Unpin,
K: Unpin,
V: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,