diff options
| -rw-r--r-- | embassy-sync/src/channel.rs | 8 | ||||
| -rw-r--r-- | embassy-sync/src/lib.rs | 1 | ||||
| -rw-r--r-- | embassy-sync/src/priority_channel.rs (renamed from embassy-sync/src/channel/priority.rs) | 5 |
3 files changed, 6 insertions, 8 deletions
diff --git a/embassy-sync/src/channel.rs b/embassy-sync/src/channel.rs index 1843bbae0..ff7129303 100644 --- a/embassy-sync/src/channel.rs +++ b/embassy-sync/src/channel.rs | |||
| @@ -29,8 +29,6 @@ use crate::blocking_mutex::raw::RawMutex; | |||
| 29 | use crate::blocking_mutex::Mutex; | 29 | use crate::blocking_mutex::Mutex; |
| 30 | use crate::waitqueue::WakerRegistration; | 30 | use crate::waitqueue::WakerRegistration; |
| 31 | 31 | ||
| 32 | pub mod priority; | ||
| 33 | |||
| 34 | /// Send-only access to a [`Channel`]. | 32 | /// Send-only access to a [`Channel`]. |
| 35 | pub struct Sender<'ch, M, T, const N: usize> | 33 | pub struct Sender<'ch, M, T, const N: usize> |
| 36 | where | 34 | where |
| @@ -78,7 +76,7 @@ where | |||
| 78 | 76 | ||
| 79 | /// Send-only access to a [`Channel`] without knowing channel size. | 77 | /// Send-only access to a [`Channel`] without knowing channel size. |
| 80 | pub struct DynamicSender<'ch, T> { | 78 | pub struct DynamicSender<'ch, T> { |
| 81 | channel: &'ch dyn DynamicChannel<T>, | 79 | pub(crate) channel: &'ch dyn DynamicChannel<T>, |
| 82 | } | 80 | } |
| 83 | 81 | ||
| 84 | impl<'ch, T> Clone for DynamicSender<'ch, T> { | 82 | impl<'ch, T> Clone for DynamicSender<'ch, T> { |
| @@ -178,7 +176,7 @@ where | |||
| 178 | 176 | ||
| 179 | /// Receive-only access to a [`Channel`] without knowing channel size. | 177 | /// Receive-only access to a [`Channel`] without knowing channel size. |
| 180 | pub struct DynamicReceiver<'ch, T> { | 178 | pub struct DynamicReceiver<'ch, T> { |
| 181 | channel: &'ch dyn DynamicChannel<T>, | 179 | pub(crate) channel: &'ch dyn DynamicChannel<T>, |
| 182 | } | 180 | } |
| 183 | 181 | ||
| 184 | impl<'ch, T> Clone for DynamicReceiver<'ch, T> { | 182 | impl<'ch, T> Clone for DynamicReceiver<'ch, T> { |
| @@ -323,7 +321,7 @@ impl<'ch, T> Future for DynamicSendFuture<'ch, T> { | |||
| 323 | 321 | ||
| 324 | impl<'ch, T> Unpin for DynamicSendFuture<'ch, T> {} | 322 | impl<'ch, T> Unpin for DynamicSendFuture<'ch, T> {} |
| 325 | 323 | ||
| 326 | trait DynamicChannel<T> { | 324 | pub(crate) trait DynamicChannel<T> { |
| 327 | fn try_send_with_context(&self, message: T, cx: Option<&mut Context<'_>>) -> Result<(), TrySendError<T>>; | 325 | fn try_send_with_context(&self, message: T, cx: Option<&mut Context<'_>>) -> Result<(), TrySendError<T>>; |
| 328 | 326 | ||
| 329 | fn try_receive_with_context(&self, cx: Option<&mut Context<'_>>) -> Result<T, TryReceiveError>; | 327 | fn try_receive_with_context(&self, cx: Option<&mut Context<'_>>) -> Result<T, TryReceiveError>; |
diff --git a/embassy-sync/src/lib.rs b/embassy-sync/src/lib.rs index c40fa3b6a..3ffcb9135 100644 --- a/embassy-sync/src/lib.rs +++ b/embassy-sync/src/lib.rs | |||
| @@ -15,6 +15,7 @@ pub mod blocking_mutex; | |||
| 15 | pub mod channel; | 15 | pub mod channel; |
| 16 | pub mod mutex; | 16 | pub mod mutex; |
| 17 | pub mod pipe; | 17 | pub mod pipe; |
| 18 | pub mod priority_channel; | ||
| 18 | pub mod pubsub; | 19 | pub mod pubsub; |
| 19 | pub mod signal; | 20 | pub mod signal; |
| 20 | pub mod waitqueue; | 21 | pub mod waitqueue; |
diff --git a/embassy-sync/src/channel/priority.rs b/embassy-sync/src/priority_channel.rs index 61dc7be68..bd75c0135 100644 --- a/embassy-sync/src/channel/priority.rs +++ b/embassy-sync/src/priority_channel.rs | |||
| @@ -8,7 +8,7 @@ use core::future::Future; | |||
| 8 | use core::pin::Pin; | 8 | use core::pin::Pin; |
| 9 | use core::task::{Context, Poll}; | 9 | use core::task::{Context, Poll}; |
| 10 | 10 | ||
| 11 | use heapless::binary_heap::Kind; | 11 | pub use heapless::binary_heap::{Kind, Max, Min}; |
| 12 | use heapless::BinaryHeap; | 12 | use heapless::BinaryHeap; |
| 13 | 13 | ||
| 14 | use crate::blocking_mutex::raw::RawMutex; | 14 | use crate::blocking_mutex::raw::RawMutex; |
| @@ -344,8 +344,7 @@ where | |||
| 344 | /// Establish a new bounded channel. For example, to create one with a NoopMutex: | 344 | /// Establish a new bounded channel. For example, to create one with a NoopMutex: |
| 345 | /// | 345 | /// |
| 346 | /// ``` | 346 | /// ``` |
| 347 | /// # use heapless::binary_heap::Max; | 347 | /// use embassy_sync::priority_channel::{PriorityChannel, Max}; |
| 348 | /// use embassy_sync::channel::priority::PriorityChannel; | ||
| 349 | /// use embassy_sync::blocking_mutex::raw::NoopRawMutex; | 348 | /// use embassy_sync::blocking_mutex::raw::NoopRawMutex; |
| 350 | /// | 349 | /// |
| 351 | /// // Declare a bounded channel of 3 u32s. | 350 | /// // Declare a bounded channel of 3 u32s. |
