pub struct ModelSet { /* private fields */ }Expand description
An ordered collection of Model definitions.
ModelSet is the primary container used to hold all models in a schema.
Models are stored in insertion order and can be iterated over by reference
or by value.
§Examples
use toasty_core::schema::app::{Model, ModelSet};
let mut set = ModelSet::new();
assert_eq!(set.iter().len(), 0);Implementations§
Source§impl ModelSet
impl ModelSet
Sourcepub fn contains(&self, id: ModelId) -> bool
pub fn contains(&self, id: ModelId) -> bool
Returns true if the set contains a model with the given ID.
Sourcepub fn add(&mut self, model: Model)
pub fn add(&mut self, model: Model)
Inserts a model into the set, keyed by its ModelId.
If a model with the same ID already exists, it is replaced.
Sourcepub fn iter(&self) -> impl ExactSizeIterator<Item = &Model>
pub fn iter(&self) -> impl ExactSizeIterator<Item = &Model>
Returns an iterator over the models in insertion order.
Trait Implementations§
Source§impl<'a> IntoIterator for &'a ModelSet
impl<'a> IntoIterator for &'a ModelSet
Auto Trait Implementations§
impl Freeze for ModelSet
impl RefUnwindSafe for ModelSet
impl Send for ModelSet
impl Sync for ModelSet
impl Unpin for ModelSet
impl UnwindSafe for ModelSet
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