pub struct SavedCard { /* private fields */ }
Expand description

Represents a card that has been saved as a toml file, which is basically anywhere in the codebase except for when youre constructing a new card. Don’t save this in containers or pass to functions, rather use the Id, and get new instances of SavedCard from the cache. Also, every time you mutate it, call the persist() method.

Implementations§

source§

impl SavedCard

source

pub fn print(&self) -> String

source

pub fn set_priority(&mut self, priority: Priority)

source

pub fn priority(&self) -> &Priority

source

pub fn expected_gain(&self) -> Option<f32>

source

pub fn get_info(&self, cache: &mut CardCache) -> Option<CardInfo>

source

pub fn reviews(&self) -> &Vec<Review>

source

pub fn raw_reviews(&self) -> &Reviews

source

pub fn new(card: Card, location: CardLocation, last_modified: Duration) -> Self

source

pub fn get_unfinished_dependent_qty(&self, cache: &mut CardCache) -> usize

source

pub fn last_modified(&self) -> Duration

source

pub fn category(&self) -> &Category

source

pub fn front_text(&self) -> &str

source

pub fn is_pending(&self) -> bool

source

pub fn is_suspended(&self) -> bool

source

pub fn is_finished(&self) -> bool

source

pub fn set_front_text(&mut self, text: &str)

source

pub fn set_back_text(&mut self, text: &str)

source

pub fn merge_with(&mut self, cache: &mut CardCache, other_card: Id)

If you accidentally made two identical cards, this will merge the stuff like depencies, reviews etc.. and delete the other card

source

pub fn stability(&self) -> Option<Duration>

source

pub fn recall_rate(&self) -> Option<f32>

source

pub fn recall_rate_sortable(&self) -> Option<u32>

dumb lol no internet will fix later

source

pub fn trad_recall_rate_at_time(&self, time: Duration) -> Option<f32>

source

pub fn strength(&self) -> Option<Duration>

source

pub fn time_since_last_review(&self) -> Option<Duration>

source

pub fn back_text(&self) -> &str

source

pub fn contains_tag(&self, tag: &str) -> bool

source

pub fn id(&self) -> Id

source

pub fn dependent_ids(&self) -> &BTreeSet<Id>

source

pub fn dependency_ids(&self) -> &BTreeSet<Id>

source

pub fn set_suspended(&mut self, suspended: IsSuspended)

source

pub fn set_finished(&mut self, finished: bool)

source

pub fn insert_tag(&mut self, tag: String)

source

pub fn check_cycle( cache: &mut CardCache, id: Id, is_dependent: bool ) -> Option<Vec<Id>>

source

pub fn set_dependency( &mut self, id: Id, cache: &mut CardCache ) -> Option<String>

source

pub fn set_dependent(&mut self, id: Id, cache: &mut CardCache) -> Option<String>

source

pub fn _insert_dependency_raw( dependent_id: &Id, dependency_id: &Id, insertion_id: &Id, cache: &mut CardCache )

a = span means foo b = change span desc by.. inserted: c = what is a span desc?

source

pub fn remove_dependency(&mut self, id: &Id, _cache: &mut CardCache)

source

pub fn remove_dependent(&mut self, id: &Id, _cache: &mut CardCache)

source

pub fn as_path(&self) -> PathBuf

source

pub fn pending_filter(card: Id, cache: &mut CardCache) -> bool

source

pub fn random_filter(card: Id, cache: &mut CardCache) -> bool

source

pub fn unfinished_filter(card: Id, cache: &mut CardCache) -> bool

source

pub fn review_filter(card: Id, cache: &mut CardCache) -> bool

source

pub fn is_outdated(&self) -> bool

Checks if corresponding file has been modified after this type got deserialized from the file.

source

pub fn is_resolved(&self, cache: &mut CardCache) -> bool

source

pub fn is_confidently_resolved(&self, cache: &mut CardCache) -> bool

Checks that its dependencies are not only marked finished, but they’re also strong memories.

source

pub fn move_card(self, destination: &Category, cache: &mut CardCache) -> Self

Moves card by deleting it and then creating it again in a new location warning: will refresh file name

source

pub fn get_review_type(&self) -> ReviewType

source

pub fn delete(self, cache: &mut CardCache)

source

pub fn get_cards_from_category_recursively( category: &Category ) -> HashSet<SavedCard>

source

pub fn search_in_cards<'a>( input: &'a str, cards: &'a HashSet<SavedCard>, excluded_cards: &'a HashSet<Id> ) -> Vec<&'a SavedCard>

source

pub fn from_id(id: &Id) -> Option<Self>

source

pub fn load_all_cards() -> HashSet<SavedCard>

source

pub fn edit_with_vim(&self) -> Self

source

pub fn from_path(path: &Path) -> Self

source

pub fn into_card(self) -> Card

source

pub fn new_review(&mut self, grade: Grade, time: Duration)

source

pub fn fake_new_review( &mut self, grade: Grade, time: Duration, at_time: Duration )

source

pub fn lapses(&self) -> u32

Trait Implementations§

source§

impl Clone for SavedCard

source§

fn clone(&self) -> SavedCard

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for SavedCard

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for SavedCard

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<SavedCard> for Card

source§

fn from(value: SavedCard) -> Self

Converts to this type from the input type.
source§

impl Hash for SavedCard

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Ord for SavedCard

source§

fn cmp(&self, other: &SavedCard) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for SavedCard

source§

fn eq(&self, other: &SavedCard) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for SavedCard

source§

fn partial_cmp(&self, other: &SavedCard) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Eq for SavedCard

source§

impl StructuralEq for SavedCard

source§

impl StructuralPartialEq for SavedCard

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where 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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where 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 T
where 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.