diff --git a/src/lib.rs b/src/lib.rs index 84fac69..915b039 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -39,7 +39,6 @@ mod test_message { } /// Application client to MoreThanText -#[derive(Clone)] pub struct MoreThanText { session: Option, tx: Sender, @@ -115,6 +114,15 @@ impl MoreThanText { } } +impl Clone for MoreThanText { + fn clone(&self) -> Self { + Self { + session: None, + tx: self.tx.clone(), + } + } +} + #[cfg(test)] mod mtt_client { use super::*; @@ -140,4 +148,12 @@ mod mtt_client { mtt.open_session(None); assert_ne!(mtt.get_id(), id1); } + + #[test] + fn cloned_clients_have_no_session() { + let mut mtt = MoreThanText::new(); + mtt.open_session(None); + let result = mtt.clone(); + assert!(result.session.is_none()); + } }