ssr_core::tasks_facade

Trait TasksFacade

source
pub trait TasksFacade<'a, T: Task<'a>>: Serialize + Deserialize<'a> {
    // Required methods
    fn new(name: String) -> Self;
    fn get_name(&self) -> &str;
    fn tasks_total(&self) -> usize;
    fn tasks_to_complete(&self) -> usize;
    fn complete_task(
        &mut self,
        interaction: &mut impl FnMut(Blocks) -> Result<Response>,
    ) -> Result<(), Error>;
    fn insert(&mut self, task: T);
    fn iter<'t>(&'t self) -> impl Iterator<Item = (&'t T, u128)>
       where T: 't;
    fn remove(&mut self, id: u128) -> bool;
}

Required Methods§

source

fn new(name: String) -> Self

source

fn get_name(&self) -> &str

source

fn tasks_total(&self) -> usize

source

fn tasks_to_complete(&self) -> usize

source

fn complete_task( &mut self, interaction: &mut impl FnMut(Blocks) -> Result<Response>, ) -> Result<(), Error>

If an error occurs, the tasks facade will remain unmodified.

source

fn insert(&mut self, task: T)

source

fn iter<'t>(&'t self) -> impl Iterator<Item = (&'t T, u128)>
where T: 't,

Return itrator of (&task, id)

source

fn remove(&mut self, id: u128) -> bool

Remove task. Returns whether such an element was present.

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§