Skip to content

Commit fba7d15

Browse files
committed
implemented debug for unbounded
1 parent 2d946b3 commit fba7d15

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

src/lfstd.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
use core::{
2-
cell::UnsafeCell,
3-
marker::PhantomData,
4-
ptr::{NonNull, null_mut},
2+
cell::UnsafeCell, fmt::Debug, marker::PhantomData, ptr::{null_mut, NonNull}
53
};
64

75
use crossbeam_utils::CachePadded;
@@ -446,6 +444,7 @@ where
446444
}
447445
}
448446

447+
449448
/// An unbounded lock-free queue. This is the LCSQ from the ACM paper,
450449
/// "A Scalable, Portable, and Memory-Efficient Lock-Free FIFO Queue" by Ruslan Nikolaev.
451450
///
@@ -472,6 +471,16 @@ pub struct UnboundedQueue<T> {
472471
}
473472

474473

474+
impl<T: Debug> core::fmt::Debug for UnboundedQueue<T> {
475+
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
476+
f.debug_struct("UnboundedQueue")
477+
.field("internal", &self.internal)
478+
.field("size", &self.size)
479+
.field("domain", &"Domain")
480+
.finish()
481+
}
482+
}
483+
475484
/// The domain for queues.
476485
#[non_exhaustive]
477486
struct QueueDomain;

0 commit comments

Comments
 (0)