preps future ideas
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
mod meal;
|
||||
mod storage;
|
||||
mod importer;
|
||||
|
||||
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)]
|
||||
pub struct Meal {
|
||||
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