From 66ebe496217f6204b80ff7c30a5c110b754cd395 Mon Sep 17 00:00:00 2001 From: comavius <comavius@proton.me> Date: Thu, 19 Sep 2024 18:44:26 +0900 Subject: [PATCH 1/5] =?UTF-8?q?=E2=9C=A8=20telnet=20module?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- judge-control-app/src/main.rs | 2 ++ judge-control-app/src/telnet.rs | 1 + 2 files changed, 3 insertions(+) create mode 100644 judge-control-app/src/telnet.rs diff --git a/judge-control-app/src/main.rs b/judge-control-app/src/main.rs index e7a11a9..a1a5832 100644 --- a/judge-control-app/src/main.rs +++ b/judge-control-app/src/main.rs @@ -1,3 +1,5 @@ +mod telnet; + fn main() { println!("Hello, world!"); } diff --git a/judge-control-app/src/telnet.rs b/judge-control-app/src/telnet.rs new file mode 100644 index 0000000..f6ac8fc --- /dev/null +++ b/judge-control-app/src/telnet.rs @@ -0,0 +1 @@ +pub mod traits; From 4753d3578d53d2d0fce8f4761b32c84d150e2e2e Mon Sep 17 00:00:00 2001 From: comavius <comavius@proton.me> Date: Thu, 19 Sep 2024 18:44:48 +0900 Subject: [PATCH 2/5] =?UTF-8?q?=E2=9C=A8=20telnet=20trait?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- judge-control-app/src/telnet/traits.rs | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 judge-control-app/src/telnet/traits.rs diff --git a/judge-control-app/src/telnet/traits.rs b/judge-control-app/src/telnet/traits.rs new file mode 100644 index 0000000..24f0503 --- /dev/null +++ b/judge-control-app/src/telnet/traits.rs @@ -0,0 +1,7 @@ +use anyhow::Result; +use std::net::ToSocketAddrs; + +pub trait Telnet { + fn new<Addr: ToSocketAddrs>(addr: Addr) -> Self; + fn exec(&mut self, cmd: &str) -> Result<String>; +} From dfaec5a36ff456a64438a94b9f7ccae9a5d9a827 Mon Sep 17 00:00:00 2001 From: comavius <comavius@proton.me> Date: Thu, 19 Sep 2024 18:52:37 +0900 Subject: [PATCH 3/5] =?UTF-8?q?=F0=9F=9A=A7=20exec=20returns=20future?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- judge-control-app/src/telnet/traits.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/judge-control-app/src/telnet/traits.rs b/judge-control-app/src/telnet/traits.rs index 24f0503..7f0eb15 100644 --- a/judge-control-app/src/telnet/traits.rs +++ b/judge-control-app/src/telnet/traits.rs @@ -1,7 +1,8 @@ use anyhow::Result; +use std::future::Future; use std::net::ToSocketAddrs; pub trait Telnet { fn new<Addr: ToSocketAddrs>(addr: Addr) -> Self; - fn exec(&mut self, cmd: &str) -> Result<String>; + fn exec(&mut self, cmd: &str) -> Result<impl Future<Output = Result<String>>>; } From 60430d8f340593105c7287c6b6e1e258ab7f155a Mon Sep 17 00:00:00 2001 From: comavius <comavius@proton.me> Date: Thu, 19 Sep 2024 20:24:06 +0900 Subject: [PATCH 4/5] =?UTF-8?q?=F0=9F=90=9B=20result=20not=20needed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- judge-control-app/src/telnet/traits.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/judge-control-app/src/telnet/traits.rs b/judge-control-app/src/telnet/traits.rs index 7f0eb15..1e5ac21 100644 --- a/judge-control-app/src/telnet/traits.rs +++ b/judge-control-app/src/telnet/traits.rs @@ -4,5 +4,5 @@ use std::net::ToSocketAddrs; pub trait Telnet { fn new<Addr: ToSocketAddrs>(addr: Addr) -> Self; - fn exec(&mut self, cmd: &str) -> Result<impl Future<Output = Result<String>>>; + fn exec(&mut self, cmd: &str) -> impl Future<Output = Result<String>>; } From bb15b3812bd024c504a80749e97a2bd79086d40b Mon Sep 17 00:00:00 2001 From: comavius <comavius@proton.me> Date: Thu, 19 Sep 2024 20:43:02 +0900 Subject: [PATCH 5/5] =?UTF-8?q?=F0=9F=8E=A8=20cargo=20fmt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- judge-control-app/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/judge-control-app/src/main.rs b/judge-control-app/src/main.rs index 554c495..ad6d617 100644 --- a/judge-control-app/src/main.rs +++ b/judge-control-app/src/main.rs @@ -1,5 +1,5 @@ -mod telnet; mod custom_file; +mod telnet; fn main() { println!("Hello, world!");