pub struct StepImageCollection {
pub images: HashMap<usize, HashMap<usize, String>>,
}Expand description
Represents the complete collection of step images for a recipe.
Images are discovered based on the Cooklang naming convention:
RecipeName.N.ext: Stored at [0][N-1] (section 0 = linear/no section)RecipeName.S.N.ext: Stored at [S-1][N-1] (section S, step N)
File numbering is one-indexed (Recipe.1.jpg = first step) Internal HashMap keys are zero-indexed Section 0 is reserved for linear recipes without sections.
Supported extensions: jpg, jpeg, png, webp
Fields§
§images: HashMap<usize, HashMap<usize, String>>Two-dimensional map: section_index -> step_index -> image_path
- Section 0: steps for linear recipes (Recipe.N.ext stored at [0][N-1])
- Section 1+: steps within sections (Recipe.S.N.ext stored at [S-1][N-1])
HashMap keys are zero-indexed
Implementations§
Source§impl StepImageCollection
impl StepImageCollection
Sourcepub fn get(&self, section: usize, step: usize) -> Option<&String>
pub fn get(&self, section: usize, step: usize) -> Option<&String>
Gets an image for a specific section and step.
§Arguments
section- Section number (0 for linear recipes, 1+ for sectioned recipes, one-indexed for sections)step- One-indexed step number (1 = first step)
§Returns
Image path if found, None otherwise
§Examples
// Get step 3 in linear recipe (Recipe.3.jpg stored at [0][2])
let img = images.get(0, 3);
// Get section 2, step 4 (Recipe.2.4.jpg stored at [1][3])
let img = images.get(2, 4);Trait Implementations§
Source§impl Clone for StepImageCollection
impl Clone for StepImageCollection
Source§fn clone(&self) -> StepImageCollection
fn clone(&self) -> StepImageCollection
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 StepImageCollection
impl Debug for StepImageCollection
Source§impl Default for StepImageCollection
impl Default for StepImageCollection
Source§fn default() -> StepImageCollection
fn default() -> StepImageCollection
Returns the “default value” for a type. Read more
Source§impl From<&StepImageCollection> for FfiStepImages
impl From<&StepImageCollection> for FfiStepImages
Source§fn from(c: &StepImageCollection) -> Self
fn from(c: &StepImageCollection) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for StepImageCollection
impl RefUnwindSafe for StepImageCollection
impl Send for StepImageCollection
impl Sync for StepImageCollection
impl Unpin for StepImageCollection
impl UnsafeUnpin for StepImageCollection
impl UnwindSafe for StepImageCollection
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