diff --git a/rtic-sync/src/signal.rs b/rtic-sync/src/signal.rs index 2595f6fb7a..47a96cc563 100644 --- a/rtic-sync/src/signal.rs +++ b/rtic-sync/src/signal.rs @@ -17,6 +17,18 @@ pub struct Signal { store: UnsafeCell>, } +impl core::fmt::Debug for Signal +where + T: core::marker::Copy, +{ + fn fmt(&self, fmt: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + fmt.write_fmt(format_args!( + "Signal<{}>{{ .. }}", + core::any::type_name::() + )) + } +} + impl Default for Signal { fn default() -> Self { Self::new() @@ -41,12 +53,24 @@ impl Signal { } } -/// Fascilitates the writing of values to a Signal. +/// Facilitates the writing of values to a Signal. #[derive(Clone)] pub struct SignalWriter<'a, T: Copy> { parent: &'a Signal, } +impl core::fmt::Debug for SignalWriter<'_, T> +where + T: core::marker::Copy, +{ + fn fmt(&self, fmt: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + fmt.write_fmt(format_args!( + "SignalWriter<{}>{{ .. }}", + core::any::type_name::() + )) + } +} + impl<'a, T: Copy> SignalWriter<'a, T> { /// Write a raw Store value to the Signal. fn write_inner(&mut self, value: Store) { @@ -69,11 +93,23 @@ impl<'a, T: Copy> SignalWriter<'a, T> { } } -/// Fascilitates the async reading of values from the Signal. +/// Facilitates the async reading of values from the Signal. pub struct SignalReader<'a, T: Copy> { parent: &'a Signal, } +impl core::fmt::Debug for SignalReader<'_, T> +where + T: core::marker::Copy, +{ + fn fmt(&self, fmt: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + fmt.write_fmt(format_args!( + "SignalReader<{}>{{ .. }}", + core::any::type_name::() + )) + } +} + impl<'a, T: Copy> SignalReader<'a, T> { /// Immediately read and evict the latest value stored in the Signal. fn take(&mut self) -> Store {