diff options
| author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2022-11-22 15:04:24 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-11-22 15:04:24 +0000 |
| commit | 61be0e75c83961a42fc1d844159f1fed7d8afbea (patch) | |
| tree | 552b2301c0c5d337b6f9a9b40d351255d4168f52 | |
| parent | ca4f615b25d2e135f3f8d6caf99fceaab1e01c24 (diff) | |
| parent | 536b6a2de5c5342a27dc1095f5642792fb6d860b (diff) | |
Merge #1068
1068: Add Default to some types r=Dirbaio a=mkj
These are a couple of places I've found `Default` to be handy
Co-authored-by: Matt Johnston <[email protected]>
| -rw-r--r-- | embassy-sync/src/signal.rs | 9 | ||||
| -rw-r--r-- | embassy-sync/src/waitqueue/waker.rs | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/embassy-sync/src/signal.rs b/embassy-sync/src/signal.rs index c3c10a8af..bea67d8be 100644 --- a/embassy-sync/src/signal.rs +++ b/embassy-sync/src/signal.rs | |||
| @@ -56,6 +56,15 @@ where | |||
| 56 | } | 56 | } |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | impl<M, T> Default for Signal<M, T> | ||
| 60 | where | ||
| 61 | M: RawMutex, | ||
| 62 | { | ||
| 63 | fn default() -> Self { | ||
| 64 | Self::new() | ||
| 65 | } | ||
| 66 | } | ||
| 67 | |||
| 59 | impl<M, T: Send> Signal<M, T> | 68 | impl<M, T: Send> Signal<M, T> |
| 60 | where | 69 | where |
| 61 | M: RawMutex, | 70 | M: RawMutex, |
diff --git a/embassy-sync/src/waitqueue/waker.rs b/embassy-sync/src/waitqueue/waker.rs index 64e300eb8..9ce94a089 100644 --- a/embassy-sync/src/waitqueue/waker.rs +++ b/embassy-sync/src/waitqueue/waker.rs | |||
| @@ -6,7 +6,7 @@ use crate::blocking_mutex::raw::CriticalSectionRawMutex; | |||
| 6 | use crate::blocking_mutex::Mutex; | 6 | use crate::blocking_mutex::Mutex; |
| 7 | 7 | ||
| 8 | /// Utility struct to register and wake a waker. | 8 | /// Utility struct to register and wake a waker. |
| 9 | #[derive(Debug)] | 9 | #[derive(Debug, Default)] |
| 10 | pub struct WakerRegistration { | 10 | pub struct WakerRegistration { |
| 11 | waker: Option<Waker>, | 11 | waker: Option<Waker>, |
| 12 | } | 12 | } |
