diff --git a/src/lib.rs b/src/lib.rs index 7da7cf0..7e38218 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -25,6 +25,7 @@ use crate::{ext::*, model::*}; mod builder; mod ext; +#[derive(Clone)] enum LoginState { CookieProvided { cookie: String, @@ -76,6 +77,7 @@ pub struct Qbit { state: Mutex, } + impl Qbit { /// Create a new [`QbitBuilder`] to build a [`Qbit`] instance. pub fn builder() -> QbitBuilder { @@ -1505,6 +1507,13 @@ impl Qbit { } } +impl Clone for Qbit { + fn clone(&self) -> Self { + let state = self.state.lock().unwrap().clone(); + Self { client: self.client.clone(), endpoint: self.endpoint.clone(), state: Mutex::new(state) } + } +} + const NONE: Option<&'static ()> = Option::None; #[derive(Debug, thiserror::Error)]