summaryrefslogtreecommitdiff
path: root/rust
diff options
context:
space:
mode:
Diffstat (limited to 'rust')
-rw-r--r--rust/src/headless.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/rust/src/headless.rs b/rust/src/headless.rs
index fce8fbe7..f37259fd 100644
--- a/rust/src/headless.rs
+++ b/rust/src/headless.rs
@@ -295,7 +295,7 @@ pub fn license_location() -> Option<LicenseLocation> {
}
/// 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<Duration>,
}
@@ -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);