Compare commits

...

2 Commits

Author SHA1 Message Date
artus
5233e44bf4 preps future ideas 2019-01-05 21:56:17 +01:00
artus
8699dfef33 inits importer module 2019-01-05 21:37:19 +01:00
4 changed files with 38 additions and 0 deletions

4
cookbook/src/importer.rs Normal file
View File

@@ -0,0 +1,4 @@
//! Import recipes from the web
//!

View File

@@ -1,4 +1,6 @@
mod meal; mod meal;
mod storage;
mod importer;
pub use self::meal::Meal; pub use self::meal::Meal;

View File

@@ -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
View 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(())
}
}