add card queue/type enums

This commit is contained in:
Damien Elmes 2020-03-17 12:33:29 +10:00
parent 91d7b02325
commit 761d1d1812
3 changed files with 36 additions and 0 deletions

View File

@ -36,6 +36,8 @@ slog = { version = "2.5.2", features = ["max_level_trace", "release_max_level_de
slog-term = "2.5.0"
slog-async = "2.4.0"
slog-envlogger = "2.2.0"
serde_repr = "0.1.5"
num_enum = "0.4.2"
[target.'cfg(target_vendor="apple")'.dependencies]
rusqlite = { version = "0.21.0", features = ["trace"] }

33
rslib/src/card.rs Normal file
View File

@ -0,0 +1,33 @@
// Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
use num_enum::TryFromPrimitive;
use serde_repr::{Deserialize_repr, Serialize_repr};
#[derive(Serialize_repr, Deserialize_repr, Debug, PartialEq, TryFromPrimitive, Clone, Copy)]
#[repr(u8)]
pub enum CardType {
New = 0,
Learn = 1,
Review = 2,
Relearn = 3,
}
#[derive(Serialize_repr, Deserialize_repr, Debug, PartialEq, TryFromPrimitive, Clone, Copy)]
#[repr(i8)]
pub enum CardQueue {
/// due is the order cards are shown in
New = 0,
/// due is a unix timestamp
Learn = 1,
/// due is days since creation date
Review = 2,
DayLearn = 3,
/// due is a unix timestamp.
/// preview cards only placed here when failed.
PreviewRepeat = 4,
/// cards are not due in these states
Suspended = -1,
UserBuried = -2,
SchedBuried = -3,
}

View File

@ -10,6 +10,7 @@ pub fn version() -> &'static str {
}
pub mod backend;
pub mod card;
pub mod cloze;
pub mod collection;
pub mod err;