Compare commits
2 Commits
2d544e334d
...
5233e44bf4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5233e44bf4 | ||
|
|
8699dfef33 |
4
cookbook/src/importer.rs
Normal file
4
cookbook/src/importer.rs
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
//! Import recipes from the web
|
||||||
|
//!
|
||||||
|
|
||||||
|
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
mod meal;
|
mod meal;
|
||||||
|
mod storage;
|
||||||
|
mod importer;
|
||||||
|
|
||||||
pub use self::meal::Meal;
|
pub use self::meal::Meal;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,17 @@
|
|||||||
|
|
||||||
|
/// An individual ingredient
|
||||||
|
pub struct Ingredient {
|
||||||
|
name: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Ingredient {
|
||||||
|
|
||||||
|
pub(super) fn new(name: String) -> Ingredient {
|
||||||
|
Ingredient { name }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// An ordered set of dishes
|
||||||
#[derive(Debug,Clone)]
|
#[derive(Debug,Clone)]
|
||||||
pub struct Meal {
|
pub struct Meal {
|
||||||
name: String,
|
name: String,
|
||||||
|
|||||||
20
cookbook/src/storage.rs
Normal file
20
cookbook/src/storage.rs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
//! Storage backend for persistent data
|
||||||
|
//!
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
/// An entry in the storage
|
||||||
|
struct Entry<T>(T);
|
||||||
|
|
||||||
|
/// A storage container
|
||||||
|
pub struct Storage<T> {
|
||||||
|
content: HashMap<String, Entry<T>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T> Storage<T> {
|
||||||
|
pub(super) fn insert(&mut self, item: T) -> Result<(), ()> {
|
||||||
|
|
||||||
|
Err(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user