Struct forne::Set

source ·
pub struct Set {
    pub method: String,
    pub cards: HashMap<Uuid, Card>,
    pub run_state: Option<String>,
    pub test_in_progress: bool,
}
Expand description

A set of cards with associated data about how learning this set has progressed.

Fields§

§method: String

The name of the method used on this set. As methods provide their own custom metadata for each card, it is not generally possible to transition a set from one learning method to another while keeping your progress, unless a transformer is provided by the methods to do so. This acts as a guard to prevent the user from accidentally deleting all their hard work!

§cards: HashMap<Uuid, Card>

A list of all the cards in the set.

§run_state: Option<String>

The state of the set in terms of tests. This will be Some(..) if there was a previous test, and the attached string will be the name of the method used. Runs on different targets will not interfere with each other, and this program is built to support them.

§test_in_progress: bool

Whether or not there is a test currently in progress. Card weightings are calculated with an internal system in tests, but no internal card metadata will be modified, this is instead used to keep track of which cards have already been shown to the user.

Note that, if a test is started on one target, and a later test is begun on a different subset target, it is possible that the latter will cause the prior to be forgotten about (since this will be set back to false once the active test is finished). This kind of issue does not affect learn mode, because there is no such thing as a finished learn mode, until all weightings are set to zero, meaning things are kept track of on a card-by-card basis, unlike in tests.

Implementations§

source§

impl Set

source

pub fn list(&self, ty: CardType) -> Vec<SlimCard>

Lists all the terms in the set of the given type, returning them as pairs of questions and answers.

Note: it is deliberately impossible to return card metadata through the traditional interface, and one should independently process that if this is required. The generical philosophy of Forne is not to interact with the method-specific metadata whenever possible, however.

source§

impl Set

source

pub fn save(&self) -> Result<String>

Saves this set to the given JSON file, preserving all progress.

source

pub fn from_json(json: &str) -> Result<Self>

Loads this set from the given JSON.

source

pub fn reset_stars(&mut self)

Resets all stars for this set. This is irreversible!

Trait Implementations§

source§

impl<'de> Deserialize<'de> for Set

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for Set

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Set

§

impl Send for Set

§

impl Sync for Set

§

impl Unpin for Set

§

impl !UnwindSafe for Set

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,