summaryrefslogtreecommitdiff
path: root/src/client/executor
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/executor')
-rw-r--r--src/client/executor/tasks.rs29
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)
+// }
+// }