summaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 248cdcc..a2a3f5c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,3 +1,5 @@
+use std::fmt::{self, Debug};
+
use parking_lot::Mutex;
thread_local! {
@@ -5,11 +7,16 @@ thread_local! {
pub static KEY: Mutex<Option<ThreadKey>> = Mutex::new(Some(unsafe { ThreadKey::new() }));
}
-#[derive(Debug)]
pub struct ThreadKey {
_priv: *const (), // this isn't Send or Sync
}
+impl Debug for ThreadKey {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ "ThreadKey".fmt(f)
+ }
+}
+
impl ThreadKey {
unsafe fn new() -> Self {
Self {