pub struct Defs<T> {
pub stems: HashSet<String>,
/* private fields */
}Expand description
Defs contain: a mapping of scope_name to a mapping of an id to T, an array of scopes in order of scope creation. a set of stem names
Fields§
§stems: HashSet<String>Implementations§
Source§impl<T> Defs<T>
impl<T> Defs<T>
Sourcepub fn new() -> Self
pub fn new() -> Self
This new is specific to WereSoCool. It creates an IndexMap<String, IndexMap> to keep track of the map of scopes. An IndexMap is an ordered HashMap. It also creates an array of scopes with a global scope prepopulated. Finally, it creates HashSet for stem names.
Sourcepub fn push_stem<S: Into<String> + Clone>(&mut self, stem_name: S)
pub fn push_stem<S: Into<String> + Clone>(&mut self, stem_name: S)
Insert a stem into stems set.
Sourcepub fn iter_scopes(&self) -> Rev<Iter<'_, String>>
pub fn iter_scopes(&self) -> Rev<Iter<'_, String>>
Iterate through the scope stack from inner to outer scopes.
Sourcepub fn iter(&self) -> Iter<'_, String, IndexMap<String, T>>
pub fn iter(&self) -> Iter<'_, String, IndexMap<String, T>>
Returns an iterator over each scope.
Sourcepub fn iter_mut(&mut self) -> IterMut<'_, String, IndexMap<String, T>>
pub fn iter_mut(&mut self) -> IterMut<'_, String, IndexMap<String, T>>
Returns a mutable iterator over each scope.
Sourcepub fn create_uuid_scope(&mut self) -> String
pub fn create_uuid_scope(&mut self) -> String
Create a new scope with a uuid as the scope name. Returns the scope name that was created.
Sourcepub fn create_named_scope<S: Into<String> + Clone>(&mut self, new_scope: S)
pub fn create_named_scope<S: Into<String> + Clone>(&mut self, new_scope: S)
Creates a named scope with the name passed in.
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for Defs<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Defs<T>where
T: Deserialize<'de>,
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
impl<T: Eq> Eq for Defs<T>
impl<T> StructuralPartialEq for Defs<T>
Auto Trait Implementations§
impl<T> Freeze for Defs<T>
impl<T> RefUnwindSafe for Defs<T>where
T: RefUnwindSafe,
impl<T> Send for Defs<T>where
T: Send,
impl<T> Sync for Defs<T>where
T: Sync,
impl<T> Unpin for Defs<T>where
T: Unpin,
impl<T> UnwindSafe for Defs<T>where
T: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.