pub struct RecipeStore { /* private fields */ }Expand description
A registry of loaded recipe cards, keyed by their globally unique id.
Implementations§
Source§impl RecipeStore
impl RecipeStore
Sourcepub fn register_book(&mut self, dir: &[(&str, &[u8])]) -> Result<(), String>
pub fn register_book(&mut self, dir: &[(&str, &[u8])]) -> Result<(), String>
Parse one crate’s embedded recipes/ tree and add its cards. Returns an
error if a manifest is malformed or a recipe id collides with one
already registered (ids must be globally unique).
Sourcepub fn insert_card(&mut self, card: RecipeCard) -> Result<(), String>
pub fn insert_card(&mut self, card: RecipeCard) -> Result<(), String>
Add a single already-built card. Errors on a duplicate id.
Sourcepub fn upsert_card(&mut self, card: RecipeCard) -> bool
pub fn upsert_card(&mut self, card: RecipeCard) -> bool
Insert a card, replacing any existing card with the same id (overlay override semantics). Returns whether an existing card was replaced.
Sourcepub fn remove(&mut self, id: &str) -> bool
pub fn remove(&mut self, id: &str) -> bool
Remove a card by id. Returns whether one was removed.
Sourcepub fn card_mut(&mut self, id: &str) -> Option<&mut RecipeCard>
pub fn card_mut(&mut self, id: &str) -> Option<&mut RecipeCard>
Mutable access to one card by id (for overlay reorder/retitle).
Sourcepub fn cards(&self) -> &[RecipeCard]
pub fn cards(&self) -> &[RecipeCard]
All registered cards, in registration order.
Sourcepub fn card(&self, id: &str) -> Option<&RecipeCard>
pub fn card(&self, id: &str) -> Option<&RecipeCard>
Look up one card by its full id.
Trait Implementations§
Source§impl Clone for RecipeStore
impl Clone for RecipeStore
Source§fn clone(&self) -> RecipeStore
fn clone(&self) -> RecipeStore
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RecipeStore
impl Debug for RecipeStore
Source§impl Default for RecipeStore
impl Default for RecipeStore
Source§fn default() -> RecipeStore
fn default() -> RecipeStore
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for RecipeStore
impl RefUnwindSafe for RecipeStore
impl Send for RecipeStore
impl Sync for RecipeStore
impl Unpin for RecipeStore
impl UnsafeUnpin for RecipeStore
impl UnwindSafe for RecipeStore
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