Skip to main content

SimulatorConfig

Struct SimulatorConfig 

Source
pub struct SimulatorConfig {
Show 17 fields pub deck_size: usize, pub learn_span: usize, pub max_cost_perday: f32, pub max_ivl: f32, pub first_rating_prob: [f32; 4], pub review_rating_prob: [f32; 3], pub learn_limit: usize, pub review_limit: usize, pub new_cards_ignore_review_limit: bool, pub suspend_after_lapses: Option<u32>, pub post_scheduling_fn: Option<PostSchedulingFn>, pub review_priority_fn: Option<ReviewPriorityFn>, pub learning_step_transitions: [[f32; 4]; 3], pub relearning_step_transitions: [[f32; 4]; 3], pub state_rating_costs: [[f32; 4]; 3], pub learning_step_count: usize, pub relearning_step_count: usize,
}

Fields§

§deck_size: usize§learn_span: usize§max_cost_perday: f32§max_ivl: f32§first_rating_prob: [f32; 4]§review_rating_prob: [f32; 3]§learn_limit: usize§review_limit: usize§new_cards_ignore_review_limit: bool§suspend_after_lapses: Option<u32>§post_scheduling_fn: Option<PostSchedulingFn>§review_priority_fn: Option<ReviewPriorityFn>§learning_step_transitions: [[f32; 4]; 3]§relearning_step_transitions: [[f32; 4]; 3]§state_rating_costs: [[f32; 4]; 3]§learning_step_count: usize§relearning_step_count: usize

Implementations§

Source§

impl SimulatorConfig

Source

pub fn with_review_priority<F>(self, f: F) -> Self
where F: Fn(&Card) -> i32 + Sync + Send + 'static,

Set the review priority callback.

use fsrs::{Card, SimulatorConfig};

let config = SimulatorConfig::default()
    .with_review_priority(|card: &Card| (card.difficulty * 100.0) as i32);
Source

pub fn with_post_scheduling<F>(self, f: F) -> Self
where F: for<'a> Fn(PostSchedulingContext<'a>) -> f32 + Sync + Send + 'static,

Set the post scheduling callback.

use fsrs::{PostSchedulingContext, SimulatorConfig};

let config = SimulatorConfig::default()
    .with_post_scheduling(|mut ctx: PostSchedulingContext<'_>| {
        let fuzz = ctx.random_f32();
        if fuzz >= 0.0 { ctx.card.interval } else { 1.0 }
    });

Trait Implementations§

Source§

impl Debug for SimulatorConfig

Source§

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

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

impl Default for SimulatorConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for SimulatorConfig

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SimulatorConfig

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
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

type Error = !

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>,

Source§

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.