Skip to content

Commit

Permalink
derive Debug for some structs
Browse files Browse the repository at this point in the history
This facilitates e.g. `my_task::spawn(my_signal_reader).unwrap();`
  • Loading branch information
SebKuzminsky committed Oct 23, 2024
1 parent f8eb018 commit aedab12
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions rtic-common/src/waker_registration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Option<Waker>>,
}
Expand Down
6 changes: 4 additions & 2 deletions rtic-sync/src/signal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T> {
Set(T),
Unset,
}

/// A "latest only" value store with unlimited writers and async waiting.
#[derive(Debug)]
pub struct Signal<T: Copy> {
waker: CriticalSectionWakerRegistration,
store: UnsafeCell<Store<T>>,
Expand Down Expand Up @@ -42,7 +43,7 @@ impl<T: Copy> Signal<T> {
}

/// Facilitates the writing of values to a Signal.
#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct SignalWriter<'a, T: Copy> {
parent: &'a Signal<T>,
}
Expand Down Expand Up @@ -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<T>,
}
Expand Down

0 comments on commit aedab12

Please sign in to comment.