pub struct Store { /* private fields */ }Expand description
A flat, key-value store for material refractive index data.
Implementations§
Source§impl Store
impl Store
pub fn new(database: HashMap<String, Material>) -> Self
Sourcepub fn insert(&mut self, key: String, material: Material)
pub fn insert(&mut self, key: String, material: Material)
Inserts a new item into the store.
§Arguments
key: The key to associate with the item.material: The item to insert into the store.
Sourcepub fn keys(&self) -> impl Iterator<Item = &String>
pub fn keys(&self) -> impl Iterator<Item = &String>
Returns an iterator over the keys in the store.
Sourcepub fn retain(&mut self, predicate: impl FnMut(&String, &mut Material) -> bool)
pub fn retain(&mut self, predicate: impl FnMut(&String, &mut Material) -> bool)
Retains only the items in the store that satisfy the given predicate.
§Arguments
predicate: The predicate to use to retain items in the store. Any item for which the predicate returnsfalsewill be removed.
Sourcepub fn remove(&mut self, key: &str) -> Option<Material>
pub fn remove(&mut self, key: &str) -> Option<Material>
Removes the item associated with the given key from the store.
§Arguments
key: The key of the item to remove from the store.
Sourcepub fn remove_many(&mut self, keys: &[String])
pub fn remove_many(&mut self, keys: &[String])
Removes multiple items from the store.
§Arguments
keys: The keys of the items to remove from the store.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Store
impl<'de> Deserialize<'de> for Store
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
Auto Trait Implementations§
impl Freeze for Store
impl RefUnwindSafe for Store
impl Send for Store
impl Sync for Store
impl Unpin for Store
impl UnwindSafe for Store
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