diff options
| author | Ulf Lilleengen <[email protected]> | 2024-10-10 19:34:46 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-10-10 19:34:46 +0000 |
| commit | 9555259c57a07338792cfe0fdd363a59616a8062 (patch) | |
| tree | 13d153d185f57e63da6dd440cfc3933e50cc87ee | |
| parent | e7dfc2bc0a9f8abdbc06f90622e5c2e618f3c9b4 (diff) | |
| parent | 592bb5a8ca8138b95ba878cd6e509c0a21d088d5 (diff) | |
Merge pull request #3402 from sourcebox/sync-additions
embassy-sync: documentation and clippy fixes
| -rw-r--r-- | embassy-sync/CHANGELOG.md | 19 | ||||
| -rw-r--r-- | embassy-sync/src/blocking_mutex/mod.rs | 1 | ||||
| -rw-r--r-- | embassy-sync/src/mutex.rs | 2 | ||||
| -rw-r--r-- | embassy-sync/src/pubsub/mod.rs | 4 |
4 files changed, 14 insertions, 12 deletions
diff --git a/embassy-sync/CHANGELOG.md b/embassy-sync/CHANGELOG.md index 1668c9319..a7dd6f66e 100644 --- a/embassy-sync/CHANGELOG.md +++ b/embassy-sync/CHANGELOG.md | |||
| @@ -7,7 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |||
| 7 | 7 | ||
| 8 | ## Unreleased | 8 | ## Unreleased |
| 9 | 9 | ||
| 10 | - Add LazyLock sync primitive. | 10 | - Add `LazyLock` sync primitive. |
| 11 | - Add `Watch` sync primitive. | ||
| 11 | - Add `clear`, `len`, `is_empty` and `is_full` functions to `zerocopy_channel`. | 12 | - Add `clear`, `len`, `is_empty` and `is_full` functions to `zerocopy_channel`. |
| 12 | - Add `capacity`, `free_capacity`, `clear`, `len`, `is_empty` and `is_full` functions to `channel::{Sender, Receiver}`. | 13 | - Add `capacity`, `free_capacity`, `clear`, `len`, `is_empty` and `is_full` functions to `channel::{Sender, Receiver}`. |
| 13 | - Add `capacity`, `free_capacity`, `clear`, `len`, `is_empty` and `is_full` functions to `priority_channel::{Sender, Receiver}`. | 14 | - Add `capacity`, `free_capacity`, `clear`, `len`, `is_empty` and `is_full` functions to `priority_channel::{Sender, Receiver}`. |
| @@ -19,20 +20,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |||
| 19 | - Add `capacity`, `free_capacity`, `clear`, `len`, `is_empty` and `is_full` functions to `PubSubChannel`. | 20 | - Add `capacity`, `free_capacity`, `clear`, `len`, `is_empty` and `is_full` functions to `PubSubChannel`. |
| 20 | - Made `PubSubBehavior` sealed | 21 | - Made `PubSubBehavior` sealed |
| 21 | - If you called `.publish_immediate(...)` on the queue directly before, then now call `.immediate_publisher().publish_immediate(...)` | 22 | - If you called `.publish_immediate(...)` on the queue directly before, then now call `.immediate_publisher().publish_immediate(...)` |
| 22 | - Add OnceLock sync primitive. | 23 | - Add `OnceLock` sync primitive. |
| 23 | - Add constructor for DynamicChannel | 24 | - Add constructor for `DynamicChannel` |
| 24 | - Add ready_to_receive functions to Channel and Receiver. | 25 | - Add ready_to_receive functions to `Channel` and `Receiver`. |
| 25 | 26 | ||
| 26 | ## 0.5.0 - 2023-12-04 | 27 | ## 0.5.0 - 2023-12-04 |
| 27 | 28 | ||
| 28 | - Add a PriorityChannel. | 29 | - Add a `PriorityChannel`. |
| 29 | - Remove nightly and unstable-traits features in preparation for 1.75. | 30 | - Remove `nightly` and `unstable-traits` features in preparation for 1.75. |
| 30 | - Upgrade heapless to 0.8. | 31 | - Upgrade `heapless` to 0.8. |
| 31 | - Upgrade static-cell to 2.0. | 32 | - Upgrade `static-cell` to 2.0. |
| 32 | 33 | ||
| 33 | ## 0.4.0 - 2023-10-31 | 34 | ## 0.4.0 - 2023-10-31 |
| 34 | 35 | ||
| 35 | - Re-add impl_trait_projections | 36 | - Re-add `impl_trait_projections` |
| 36 | - switch to `embedded-io 0.6` | 37 | - switch to `embedded-io 0.6` |
| 37 | 38 | ||
| 38 | ## 0.3.0 - 2023-09-14 | 39 | ## 0.3.0 - 2023-09-14 |
diff --git a/embassy-sync/src/blocking_mutex/mod.rs b/embassy-sync/src/blocking_mutex/mod.rs index 8a4a4c642..beafdb43d 100644 --- a/embassy-sync/src/blocking_mutex/mod.rs +++ b/embassy-sync/src/blocking_mutex/mod.rs | |||
| @@ -104,6 +104,7 @@ impl<T> Mutex<raw::CriticalSectionRawMutex, T> { | |||
| 104 | 104 | ||
| 105 | impl<T> Mutex<raw::NoopRawMutex, T> { | 105 | impl<T> Mutex<raw::NoopRawMutex, T> { |
| 106 | /// Borrows the data | 106 | /// Borrows the data |
| 107 | #[allow(clippy::should_implement_trait)] | ||
| 107 | pub fn borrow(&self) -> &T { | 108 | pub fn borrow(&self) -> &T { |
| 108 | let ptr = self.data.get() as *const T; | 109 | let ptr = self.data.get() as *const T; |
| 109 | unsafe { &*ptr } | 110 | unsafe { &*ptr } |
diff --git a/embassy-sync/src/mutex.rs b/embassy-sync/src/mutex.rs index 8c3a3af9f..08f66e374 100644 --- a/embassy-sync/src/mutex.rs +++ b/embassy-sync/src/mutex.rs | |||
| @@ -138,7 +138,7 @@ impl<M: RawMutex, T> From<T> for Mutex<M, T> { | |||
| 138 | impl<M, T> Default for Mutex<M, T> | 138 | impl<M, T> Default for Mutex<M, T> |
| 139 | where | 139 | where |
| 140 | M: RawMutex, | 140 | M: RawMutex, |
| 141 | T: ?Sized + Default, | 141 | T: Default, |
| 142 | { | 142 | { |
| 143 | fn default() -> Self { | 143 | fn default() -> Self { |
| 144 | Self::new(Default::default()) | 144 | Self::new(Default::default()) |
diff --git a/embassy-sync/src/pubsub/mod.rs b/embassy-sync/src/pubsub/mod.rs index 812302e2b..ae5951829 100644 --- a/embassy-sync/src/pubsub/mod.rs +++ b/embassy-sync/src/pubsub/mod.rs | |||
| @@ -27,8 +27,8 @@ pub use subscriber::{DynSubscriber, Subscriber}; | |||
| 27 | /// | 27 | /// |
| 28 | /// - With [Pub::publish()] the publisher has to wait until there is space in the internal message queue. | 28 | /// - With [Pub::publish()] the publisher has to wait until there is space in the internal message queue. |
| 29 | /// - With [Pub::publish_immediate()] the publisher doesn't await and instead lets the oldest message | 29 | /// - With [Pub::publish_immediate()] the publisher doesn't await and instead lets the oldest message |
| 30 | /// in the queue drop if necessary. This will cause any [Subscriber] that missed the message to receive | 30 | /// in the queue drop if necessary. This will cause any [Subscriber] that missed the message to receive |
| 31 | /// an error to indicate that it has lagged. | 31 | /// an error to indicate that it has lagged. |
| 32 | /// | 32 | /// |
| 33 | /// ## Example | 33 | /// ## Example |
| 34 | /// | 34 | /// |
