diff options
| author | Max Audron <audron@cocaine.farm> | 2021-09-28 18:13:43 +0200 |
|---|---|---|
| committer | Max Audron <audron@cocaine.farm> | 2021-09-28 18:16:20 +0200 |
| commit | 2831748466d7aca099502a265eced5d1d88c871a (patch) | |
| tree | e2ab7581cae8df2b1c041dcf81cbe22daf00e558 /src/session/mod.rs | |
| parent | add handle_syncmessage to aliasmanager (diff) | |
adapt Sync* types
Diffstat (limited to 'src/session/mod.rs')
| -rw-r--r-- | src/session/mod.rs | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/src/session/mod.rs b/src/session/mod.rs index 67045c9..7fa5c29 100644 --- a/src/session/mod.rs +++ b/src/session/mod.rs @@ -1,2 +1,45 @@ +use crate::message::{objects::AliasManager, SyncMessage, SyncProxy}; + /// The Session Trait is the main point of entry and implements the basic logic -pub trait Session {} +pub trait Session: SyncProxy { + fn alias_manager(&self) -> AliasManager; + + fn handle_syncmessage(&self, msg: SyncMessage) + where + Self: Sized, + { + match msg.class_name.as_str() { + "AliasManager" => self.alias_manager().handle_syncmessage(self, msg), + _ => (), + } + } +} + +impl<T> Session for &T +where + T: Session, +{ + fn alias_manager(&self) -> AliasManager { + 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!() + } +} |
