From 9f94611a42d41cf94cdccb00b5d2eec0d5d02970 Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 14 Nov 2021 23:25:55 +0100 Subject: Add initial working version --- src/model/card.rs | 8 ++++++++ src/model/deck.rs | 5 +++++ src/model/difficulty.rs | 16 ++++++++++++++++ src/model/mod.rs | 3 +++ 4 files changed, 32 insertions(+) create mode 100644 src/model/card.rs create mode 100644 src/model/deck.rs create mode 100644 src/model/difficulty.rs create mode 100644 src/model/mod.rs (limited to 'src/model') diff --git a/src/model/card.rs b/src/model/card.rs new file mode 100644 index 0000000..3ac395e --- /dev/null +++ b/src/model/card.rs @@ -0,0 +1,8 @@ +use crate::space_repetition; + +#[derive(Debug)] +pub struct Card { + pub question: String, + pub responses: Vec, + pub state: space_repetition::State, +} diff --git a/src/model/deck.rs b/src/model/deck.rs new file mode 100644 index 0000000..769b38c --- /dev/null +++ b/src/model/deck.rs @@ -0,0 +1,5 @@ +#[derive(Debug, Clone)] +pub struct Entry { + pub part_1: Vec, + pub part_2: Vec, +} diff --git a/src/model/difficulty.rs b/src/model/difficulty.rs new file mode 100644 index 0000000..ea5a9ce --- /dev/null +++ b/src/model/difficulty.rs @@ -0,0 +1,16 @@ +#[derive(Debug, Clone, Copy, PartialEq)] +pub enum Difficulty { + Again, + Hard, + Good, + Easy, +} + +pub fn label(difficulty: Difficulty) -> String { + match difficulty { + Difficulty::Again => "Recommencer".to_string(), + Difficulty::Hard => "Difficile".to_string(), + Difficulty::Good => "Bon".to_string(), + Difficulty::Easy => "Facile".to_string(), + } +} diff --git a/src/model/mod.rs b/src/model/mod.rs new file mode 100644 index 0000000..bbd7891 --- /dev/null +++ b/src/model/mod.rs @@ -0,0 +1,3 @@ +pub mod card; +pub mod deck; +pub mod difficulty; -- cgit v1.2.3