Trait Task

Source
pub trait Task<'a>: Serialize + Deserialize<'a> {
    type SharedState: SharedState<'a>;

    // Required methods
    fn new(input: BlocksWithAnswer) -> Self;
    fn get_blocks(&self) -> BlocksWithAnswer;
    fn next_repetition(
        &self,
        shared_state: &Self::SharedState,
        desired_retention: f64,
    ) -> SystemTime;
    fn complete(
        &mut self,
        shared_state: &mut Self::SharedState,
        desired_retention: f64,
        interaction: &mut impl FnMut(Blocks) -> Result<Response>,
    ) -> Result<()>;
}

Required Associated Types§

Required Methods§

Source

fn new(input: BlocksWithAnswer) -> Self

blocks must contain interactive elements

Source

fn get_blocks(&self) -> BlocksWithAnswer

Source

fn next_repetition( &self, shared_state: &Self::SharedState, desired_retention: f64, ) -> SystemTime

Source

fn complete( &mut self, shared_state: &mut Self::SharedState, desired_retention: f64, interaction: &mut impl FnMut(Blocks) -> Result<Response>, ) -> Result<()>

If an error occurs, the task will remain unmodified.

§Errors

If interaction return error.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§