diff --git a/rust/src/headless.rs b/rust/src/headless.rs index fce8fbe77..f37259fd7 100644 --- a/rust/src/headless.rs +++ b/rust/src/headless.rs @@ -295,7 +295,7 @@ pub fn license_location() -> Option { } /// Wrapper for [`init`] and [`shutdown`]. Instantiating this at the top of your script will initialize everything correctly and then clean itself up at exit as well. -#[derive(Debug, Default, Clone, PartialEq, Eq, Hash)] +#[derive(Debug, Default, PartialEq, Eq, Hash)] pub struct Session { license_duration: Option, } @@ -422,6 +422,15 @@ impl Session { } } +impl Clone for Session { + fn clone(&self) -> Self { + SESSION_COUNT.fetch_add(1, SeqCst); + Self { + license_duration: self.license_duration, + } + } +} + impl Drop for Session { fn drop(&mut self) { let previous_count = SESSION_COUNT.fetch_sub(1, SeqCst);