aboutsummaryrefslogtreecommitdiff
path: root/embassy-sync/src/semaphore.rs
diff options
context:
space:
mode:
authorCurly <[email protected]>2025-08-19 22:30:53 -0700
committerCurly <[email protected]>2025-08-19 22:36:49 -0700
commit368738bef44dbba1a178383d878a6d9423b1ccd9 (patch)
tree4c375e7ec4615e6dee9fda837584067d19b7caf6 /embassy-sync/src/semaphore.rs
parenta5cb04bdab602bc3bd056d254a9d61cad55bd967 (diff)
chore: add more `Debug` impls to `embassy-sync`, particularly on `OnceLock`
All tests green
Diffstat (limited to 'embassy-sync/src/semaphore.rs')
-rw-r--r--embassy-sync/src/semaphore.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/embassy-sync/src/semaphore.rs b/embassy-sync/src/semaphore.rs
index d30eee30b..4e82b0fcd 100644
--- a/embassy-sync/src/semaphore.rs
+++ b/embassy-sync/src/semaphore.rs
@@ -46,6 +46,7 @@ pub trait Semaphore: Sized {
46/// A representation of a number of acquired permits. 46/// A representation of a number of acquired permits.
47/// 47///
48/// The acquired permits will be released back to the [`Semaphore`] when this is dropped. 48/// The acquired permits will be released back to the [`Semaphore`] when this is dropped.
49#[derive(Debug)]
49pub struct SemaphoreReleaser<'a, S: Semaphore> { 50pub struct SemaphoreReleaser<'a, S: Semaphore> {
50 semaphore: &'a S, 51 semaphore: &'a S,
51 permits: usize, 52 permits: usize,
@@ -181,6 +182,7 @@ impl<M: RawMutex> Semaphore for GreedySemaphore<M> {
181 } 182 }
182} 183}
183 184
185#[derive(Debug)]
184struct SemaphoreState { 186struct SemaphoreState {
185 permits: usize, 187 permits: usize,
186 waker: WakerRegistration, 188 waker: WakerRegistration,
@@ -221,6 +223,7 @@ impl SemaphoreState {
221/// 223///
222/// Up to `N` tasks may attempt to acquire permits concurrently. If additional 224/// Up to `N` tasks may attempt to acquire permits concurrently. If additional
223/// tasks attempt to acquire a permit, a [`WaitQueueFull`] error will be returned. 225/// tasks attempt to acquire a permit, a [`WaitQueueFull`] error will be returned.
226#[derive(Debug)]
224pub struct FairSemaphore<M, const N: usize> 227pub struct FairSemaphore<M, const N: usize>
225where 228where
226 M: RawMutex, 229 M: RawMutex,
@@ -341,6 +344,7 @@ impl<M: RawMutex, const N: usize> Semaphore for FairSemaphore<M, N> {
341 } 344 }
342} 345}
343 346
347#[derive(Debug)]
344struct FairAcquire<'a, M: RawMutex, const N: usize> { 348struct FairAcquire<'a, M: RawMutex, const N: usize> {
345 sema: &'a FairSemaphore<M, N>, 349 sema: &'a FairSemaphore<M, N>,
346 permits: usize, 350 permits: usize,
@@ -364,6 +368,7 @@ impl<'a, M: RawMutex, const N: usize> core::future::Future for FairAcquire<'a, M
364 } 368 }
365} 369}
366 370
371#[derive(Debug)]
367struct FairAcquireAll<'a, M: RawMutex, const N: usize> { 372struct FairAcquireAll<'a, M: RawMutex, const N: usize> {
368 sema: &'a FairSemaphore<M, N>, 373 sema: &'a FairSemaphore<M, N>,
369 min: usize, 374 min: usize,
@@ -387,6 +392,7 @@ impl<'a, M: RawMutex, const N: usize> core::future::Future for FairAcquireAll<'a
387 } 392 }
388} 393}
389 394
395#[derive(Debug)]
390struct FairSemaphoreState<const N: usize> { 396struct FairSemaphoreState<const N: usize> {
391 permits: usize, 397 permits: usize,
392 next_ticket: usize, 398 next_ticket: usize,