diff options
| author | Max Audron <audron@cocaine.farm> | 2021-11-29 14:18:30 +0100 |
|---|---|---|
| committer | Max Audron <audron@cocaine.farm> | 2021-11-29 14:27:09 +0100 |
| commit | 6da4613578f1effb371f4f3dd6605c1dff16b0b7 (patch) | |
| tree | 655c42ce4fa483d1db149d2f3db5cc37b558ab3f /src/session/mod.rs | |
| parent | add NetworkList impl for CoreInfo (diff) | |
rework SyncProxy to use globally available channels
the SyncProxy is now a globally available OnceCell that transparently
offers a struct with methods to send syncmessages and rpccalls.
This allows me to get rid of the globally passed around syncproxy var.
The Syncable trait provides default implementations that access this
global so the library user usually does not need to use it directly.
Further the Syncable trait now provides default implementations for it's
methods and only a const for the CLASS name must be set.
It isn't very idiomatic rust and takes away some freedom from the
library user but i think that it's an overall nicer solution and
simplifies the code big time.
Diffstat (limited to 'src/session/mod.rs')
| -rw-r--r-- | src/session/mod.rs | 42 |
1 files changed, 1 insertions, 41 deletions
diff --git a/src/session/mod.rs b/src/session/mod.rs index 07dc527..6d11946 100644 --- a/src/session/mod.rs +++ b/src/session/mod.rs @@ -1,7 +1,7 @@ use crate::message::{objects::AliasManager, StatefulSyncableClient, SyncMessage, SyncProxy}; /// The Session Trait is the main point of entry and implements the basic logic -pub trait Session: SyncProxy { +pub trait Session { fn alias_manager(&mut self) -> &mut AliasManager; // fn sync(&mut self, msg: SyncMessage) @@ -23,43 +23,3 @@ where todo!() } } - -#[allow(unused_variables)] -impl<T> SyncProxy for &T -where - T: SyncProxy, -{ - fn sync( - &self, - class_name: &str, - object_name: Option<&str>, - function: &str, - params: crate::primitive::VariantList, - ) { - todo!() - } - - fn rpc(&self, function: &str, params: crate::primitive::VariantList) { - todo!() - } -} - -#[allow(unused_variables)] -impl<T> SyncProxy for &mut T -where - T: SyncProxy, -{ - fn sync( - &self, - class_name: &str, - object_name: Option<&str>, - function: &str, - params: crate::primitive::VariantList, - ) { - todo!() - } - - fn rpc(&self, function: &str, params: crate::primitive::VariantList) { - todo!() - } -} |
