From 2e7f1ee492be200fe2fe1b6204d471adec1d656b Mon Sep 17 00:00:00 2001 From: Max Audron Date: Sun, 3 Oct 2021 12:39:06 +0200 Subject: split StatefulSyncable into client and server side traits This allows to more easily put each side behind a feature flag, maintaing ease of use when only one is selected, while still allowing a consumer to enable both sides and use them. --- src/session/mod.rs | 44 ++++++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 12 deletions(-) (limited to 'src/session') diff --git a/src/session/mod.rs b/src/session/mod.rs index 7fa5c29..07dc527 100644 --- a/src/session/mod.rs +++ b/src/session/mod.rs @@ -1,25 +1,25 @@ -use crate::message::{objects::AliasManager, SyncMessage, SyncProxy}; +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 { - fn alias_manager(&self) -> AliasManager; + fn alias_manager(&mut self) -> &mut AliasManager; - fn handle_syncmessage(&self, msg: SyncMessage) - where - Self: Sized, - { - match msg.class_name.as_str() { - "AliasManager" => self.alias_manager().handle_syncmessage(self, msg), - _ => (), - } - } + // fn sync(&mut self, msg: SyncMessage) + // where + // Self: Sized, + // { + // match msg.class_name.as_str() { + // "AliasManager" => self.alias_manager().sync(self, msg), + // _ => (), + // } + // } } impl Session for &T where T: Session, { - fn alias_manager(&self) -> AliasManager { + fn alias_manager(&mut self) -> &mut AliasManager { todo!() } } @@ -43,3 +43,23 @@ where todo!() } } + +#[allow(unused_variables)] +impl 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!() + } +} -- cgit v1.2.3