aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-sync/src/channel.rs8
-rw-r--r--embassy-sync/src/lib.rs1
-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;
29use crate::blocking_mutex::Mutex; 29use crate::blocking_mutex::Mutex;
30use crate::waitqueue::WakerRegistration; 30use crate::waitqueue::WakerRegistration;
31 31
32pub mod priority;
33
34/// Send-only access to a [`Channel`]. 32/// Send-only access to a [`Channel`].
35pub struct Sender<'ch, M, T, const N: usize> 33pub struct Sender<'ch, M, T, const N: usize>
36where 34where
@@ -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.
80pub struct DynamicSender<'ch, T> { 78pub struct DynamicSender<'ch, T> {
81 channel: &'ch dyn DynamicChannel<T>, 79 pub(crate) channel: &'ch dyn DynamicChannel<T>,
82} 80}
83 81
84impl<'ch, T> Clone for DynamicSender<'ch, T> { 82impl<'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.
180pub struct DynamicReceiver<'ch, T> { 178pub struct DynamicReceiver<'ch, T> {
181 channel: &'ch dyn DynamicChannel<T>, 179 pub(crate) channel: &'ch dyn DynamicChannel<T>,
182} 180}
183 181
184impl<'ch, T> Clone for DynamicReceiver<'ch, T> { 182impl<'ch, T> Clone for DynamicReceiver<'ch, T> {
@@ -323,7 +321,7 @@ impl<'ch, T> Future for DynamicSendFuture<'ch, T> {
323 321
324impl<'ch, T> Unpin for DynamicSendFuture<'ch, T> {} 322impl<'ch, T> Unpin for DynamicSendFuture<'ch, T> {}
325 323
326trait DynamicChannel<T> { 324pub(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;
15pub mod channel; 15pub mod channel;
16pub mod mutex; 16pub mod mutex;
17pub mod pipe; 17pub mod pipe;
18pub mod priority_channel;
18pub mod pubsub; 19pub mod pubsub;
19pub mod signal; 20pub mod signal;
20pub mod waitqueue; 21pub 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;
8use core::pin::Pin; 8use core::pin::Pin;
9use core::task::{Context, Poll}; 9use core::task::{Context, Poll};
10 10
11use heapless::binary_heap::Kind; 11pub use heapless::binary_heap::{Kind, Max, Min};
12use heapless::BinaryHeap; 12use heapless::BinaryHeap;
13 13
14use crate::blocking_mutex::raw::RawMutex; 14use 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.