[][src]Struct installer::installation::Task

pub struct Task<E: Error + Send + Sync, DB: Database<E> + Send + Sync> { /* fields omitted */ }

this structure is a container for a task, or rather an abstraction over a series of steps in the installation process this struct is stored and used by the taskschedule struct, that is responsible for running tasks in parrallel perhaps it would have been easier to use async await I don't know

Implementations

impl<E: Error + Send + Sync, DB: Database<E> + Send + Sync> Task<E, DB>[src]

pub fn new<F>(task_id: u16, name: &str, func: F) -> Self where
    F: Fn(Arc<DB>, Arc<Mutex<Vec<(String, u16)>>>) -> Result<(), Box<dyn Error + Send + Sync>> + 'static + Send + Sync
[src]

create a task

Arguments

task id: some number that identifies a task name: the name of the task func: the closure that handles the code that is run in a given task

Example

let task = Task::new(0, "random task", mvoe |db|{
 // run some code in here   
    Ok(())
});
task.run().unwrap();

pub fn run(
    self,
    database: Arc<DB>,
    completed: Arc<Mutex<Vec<(String, u16)>>>
) -> Result<(String, u16), ((String, u16), Box<dyn Error + Send + Sync>)>
[src]

pub fn name(&self) -> String[src]

pub fn id(&self) -> u16[src]

Trait Implementations

impl<E: Clone + Error + Send + Sync, DB: Clone + Database<E> + Send + Sync> Clone for Task<E, DB>[src]

impl<E: Error + Send + Sync, DB: Database<E> + Send + Sync> Debug for Task<E, DB>[src]

Auto Trait Implementations

impl<E, DB> !RefUnwindSafe for Task<E, DB>

impl<E, DB> Send for Task<E, DB>

impl<E, DB> Sync for Task<E, DB>

impl<E, DB> Unpin for Task<E, DB> where
    E: Unpin

impl<E, DB> !UnwindSafe for Task<E, DB>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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