From 1376c5a617be5c25655d0d7cb63e3beaa5a6e026 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:20:39 +0200 Subject: Merging upstream version 1.70.0+dfsg1. Signed-off-by: Daniel Baumann --- vendor/syn/src/thread.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'vendor/syn/src/thread.rs') diff --git a/vendor/syn/src/thread.rs b/vendor/syn/src/thread.rs index 9e5d8ad85..63fdea834 100644 --- a/vendor/syn/src/thread.rs +++ b/vendor/syn/src/thread.rs @@ -4,7 +4,7 @@ use std::thread::{self, ThreadId}; /// ThreadBound is a Sync-maker and Send-maker that allows accessing a value /// of type T only from the original thread on which the ThreadBound was /// constructed. -pub struct ThreadBound { +pub(crate) struct ThreadBound { value: T, thread_id: ThreadId, } @@ -15,14 +15,14 @@ unsafe impl Sync for ThreadBound {} unsafe impl Send for ThreadBound {} impl ThreadBound { - pub fn new(value: T) -> Self { + pub(crate) fn new(value: T) -> Self { ThreadBound { value, thread_id: thread::current().id(), } } - pub fn get(&self) -> Option<&T> { + pub(crate) fn get(&self) -> Option<&T> { if thread::current().id() == self.thread_id { Some(&self.value) } else { @@ -39,3 +39,12 @@ impl Debug for ThreadBound { } } } + +impl Clone for ThreadBound { + fn clone(&self) -> Self { + ThreadBound { + value: self.value.clone(), + thread_id: self.thread_id, + } + } +} -- cgit v1.2.3