summaryrefslogtreecommitdiff
path: root/src/client/executor/tasks.rs
blob: 90094de9ae23c5e0c64ef7fb2c635204db4871f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use std::str::FromStr;

pub(crate) trait Task: FromStr {
    type Err: std::fmt::Display;
    type Success: std::fmt::Display = String;

    fn execute() -> Result<Self::Success, <Self as Task>::Err>;
}

pub(crate) trait IntoTask {
    type Err: std::fmt::Display;

    fn into_task(self) -> Result<impl Task, Self::Err>;
}

impl IntoTask for String {
    type Err = <String as FromStr>::Err;

    fn into_task(self) -> Result<impl Task, Self::Err> {}
}
//
// impl Task for {
//     type Err = std::num::ParseIntError;
//     type Success = u32;
//
//     fn execute() -> Result<Self::Success, Self::Err> {
//         Ok(42)
//     }
// }