summaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/connector.rs8
-rw-r--r--src/client/executor.rs5
2 files changed, 6 insertions, 7 deletions
diff --git a/src/client/connector.rs b/src/client/connector.rs
index a595c8e..6c002c9 100644
--- a/src/client/connector.rs
+++ b/src/client/connector.rs
@@ -3,12 +3,12 @@ pub mod httpconnector;
use std::net::IpAddr;
use crate::{client::Client, executor::Executor};
-use remote_control_rs::tasks::{IntoTask, NETWORK_T};
+use remote_control_rs::tasks::NETWORK_T;
-pub type Result<T: std::fmt::Display + IntoTask, E: std::fmt::Debug> = std::result::Result<T, E>;
+pub type Result<T: std::fmt::Display, E: std::fmt::Debug> = std::result::Result<T, E>;
pub trait Connection {
- type Ok: std::fmt::Display + IntoTask + AsRef<str> = String;
+ type Ok: std::fmt::Display + AsRef<str> = String;
type Err: std::fmt::Debug;
// should use channel to notify update
@@ -62,7 +62,7 @@ pub trait Connection {
None => return,
};
// FIXME: handle the errors... peak prod code
- self.ntfy(Executor::new(task, it.map(str::to_string)).unwrap().run().unwrap().clone().unwrap()).unwrap();
+ self.ntfy(Executor::new(task.try_into().unwrap(), it.map(str::to_string)).unwrap().run().unwrap().clone().unwrap()).unwrap();
}
Result::Err(e) => {
#[cfg(debug_assertions)]
diff --git a/src/client/executor.rs b/src/client/executor.rs
index 32a0fdc..379c832 100644
--- a/src/client/executor.rs
+++ b/src/client/executor.rs
@@ -1,4 +1,4 @@
-use remote_control_rs::tasks::{IntoTask, IntoTaskErr, Task};
+use remote_control_rs::tasks::{IntoTaskErr, Task};
pub struct Executor {
task: &'static Task,
@@ -7,8 +7,7 @@ pub struct Executor {
}
impl Executor {
- pub fn new(task: impl IntoTask, args: impl IntoIterator<Item = String>) -> Result<Self, IntoTaskErr> {
- let task = task.into_task()?;
+ pub fn new(task: &'static Task, args: impl IntoIterator<Item = String>) -> Result<Self, IntoTaskErr> {
Ok(Self { task: task, args: args.into_iter().collect(), output: None })
}