From 0ce50b39b530737846920515595d80811f2dfc15 Mon Sep 17 00:00:00 2001 From: ProtoByter Date: Wed, 7 Sep 2022 20:08:33 +0100 Subject: [PATCH] Net: Start work on this --- src/main.rs | 2 ++ src/message.rs | 1 + src/net/mod.rs | 11 +++++++++++ 3 files changed, 14 insertions(+) create mode 100644 src/message.rs create mode 100644 src/net/mod.rs diff --git a/src/main.rs b/src/main.rs index d24f8f0..d70ec85 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,7 @@ mod db; mod log; +mod net; +mod message; fn main() { let mut db = db::get_backend("sqlite"); diff --git a/src/message.rs b/src/message.rs new file mode 100644 index 0000000..5f1dc06 --- /dev/null +++ b/src/message.rs @@ -0,0 +1 @@ +enum Message {} \ No newline at end of file diff --git a/src/net/mod.rs b/src/net/mod.rs new file mode 100644 index 0000000..19c68de --- /dev/null +++ b/src/net/mod.rs @@ -0,0 +1,11 @@ +use crate::log::*; + +trait NetBackend { + fn start(&mut self) -> Result<(), String>; + fn stop(&mut self) -> Result<(), String>; + + fn notify_existance(&mut self) -> Result<(), String>; + fn notify_shutdown(&mut self) -> Result<(), String>; + + fn send(&mut self, id: &str, message: &str) -> Result<(), String>; +} \ No newline at end of file