From 2831748466d7aca099502a265eced5d1d88c871a Mon Sep 17 00:00:00 2001 From: Max Audron Date: Tue, 28 Sep 2021 18:13:43 +0200 Subject: adapt Sync* types --- src/session/mod.rs | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) (limited to 'src/session') 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 Session for &T +where + T: Session, +{ + fn alias_manager(&self) -> AliasManager { + todo!() + } +} + +#[allow(unused_variables)] +impl 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!() + } +} -- cgit v1.2.3