From aedab12bcc4a036cab392661e2877343bd12b77a Mon Sep 17 00:00:00 2001 From: Seb Kuzminsky Date: Wed, 23 Oct 2024 11:09:45 -0600 Subject: [PATCH] derive Debug for some structs This facilitates e.g. `my_task::spawn(my_signal_reader).unwrap();` --- rtic-common/src/waker_registration.rs | 1 + rtic-sync/src/signal.rs | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/rtic-common/src/waker_registration.rs b/rtic-common/src/waker_registration.rs index 46c8818af381..794b9b81402b 100644 --- a/rtic-common/src/waker_registration.rs +++ b/rtic-common/src/waker_registration.rs @@ -4,6 +4,7 @@ use core::cell::UnsafeCell; use core::task::Waker; /// A critical section based waker handler. +#[derive(Debug)] pub struct CriticalSectionWakerRegistration { waker: UnsafeCell>, } diff --git a/rtic-sync/src/signal.rs b/rtic-sync/src/signal.rs index 4a30c57b7bc2..da8fd9f3db10 100644 --- a/rtic-sync/src/signal.rs +++ b/rtic-sync/src/signal.rs @@ -5,13 +5,14 @@ use rtic_common::waker_registration::CriticalSectionWakerRegistration; /// Basically an Option but for indicating /// whether the store has been set or not -#[derive(Clone, Copy)] +#[derive(Clone, Copy, Debug)] enum Store { Set(T), Unset, } /// A "latest only" value store with unlimited writers and async waiting. +#[derive(Debug)] pub struct Signal { waker: CriticalSectionWakerRegistration, store: UnsafeCell>, @@ -42,7 +43,7 @@ impl Signal { } /// Facilitates the writing of values to a Signal. -#[derive(Clone)] +#[derive(Clone, Debug)] pub struct SignalWriter<'a, T: Copy> { parent: &'a Signal, } @@ -70,6 +71,7 @@ impl<'a, T: Copy> SignalWriter<'a, T> { } /// Facilitates the async reading of values from the Signal. +#[derive(Debug)] pub struct SignalReader<'a, T: Copy> { parent: &'a Signal, }