diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-09-12 23:33:54 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-09-12 23:33:54 +0800 |
| commit | 40099749a6b264593ad54032411f02df9967790c (patch) | |
| tree | 6ead79fd2c8930db1a64b80e40aa611f440dca8b /src/client/executor/tasks.rs | |
| parent | bc6b38c1b627c6dcdd50896ded4148dd6e0734ba (diff) | |
refactor: don't use concurrency, single threaded for now
Diffstat (limited to 'src/client/executor/tasks.rs')
| -rw-r--r-- | src/client/executor/tasks.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/client/executor/tasks.rs b/src/client/executor/tasks.rs new file mode 100644 index 0000000..90094de --- /dev/null +++ b/src/client/executor/tasks.rs @@ -0,0 +1,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) +// } +// } |
