diff --git a/embassy-sync/src/channel.rs b/embassy-sync/src/channel.rs index 1843bbae..ff712930 100644 --- a/embassy-sync/src/channel.rs +++ b/embassy-sync/src/channel.rs @@ -29,8 +29,6 @@ use crate::blocking_mutex::raw::RawMutex; use crate::blocking_mutex::Mutex; use crate::waitqueue::WakerRegistration; -pub mod priority; - /// Send-only access to a [`Channel`]. pub struct Sender<'ch, M, T, const N: usize> where @@ -78,7 +76,7 @@ where /// Send-only access to a [`Channel`] without knowing channel size. pub struct DynamicSender<'ch, T> { - channel: &'ch dyn DynamicChannel, + pub(crate) channel: &'ch dyn DynamicChannel, } impl<'ch, T> Clone for DynamicSender<'ch, T> { @@ -178,7 +176,7 @@ where /// Receive-only access to a [`Channel`] without knowing channel size. pub struct DynamicReceiver<'ch, T> { - channel: &'ch dyn DynamicChannel, + pub(crate) channel: &'ch dyn DynamicChannel, } impl<'ch, T> Clone for DynamicReceiver<'ch, T> { @@ -323,7 +321,7 @@ impl<'ch, T> Future for DynamicSendFuture<'ch, T> { impl<'ch, T> Unpin for DynamicSendFuture<'ch, T> {} -trait DynamicChannel { +pub(crate) trait DynamicChannel { fn try_send_with_context(&self, message: T, cx: Option<&mut Context<'_>>) -> Result<(), TrySendError>; fn try_receive_with_context(&self, cx: Option<&mut Context<'_>>) -> Result; diff --git a/embassy-sync/src/lib.rs b/embassy-sync/src/lib.rs index c40fa3b6..3ffcb913 100644 --- a/embassy-sync/src/lib.rs +++ b/embassy-sync/src/lib.rs @@ -15,6 +15,7 @@ pub mod blocking_mutex; pub mod channel; pub mod mutex; pub mod pipe; +pub mod priority_channel; pub mod pubsub; pub mod signal; pub mod waitqueue; diff --git a/embassy-sync/src/channel/priority.rs b/embassy-sync/src/priority_channel.rs similarity index 99% rename from embassy-sync/src/channel/priority.rs rename to embassy-sync/src/priority_channel.rs index 61dc7be6..bd75c013 100644 --- a/embassy-sync/src/channel/priority.rs +++ b/embassy-sync/src/priority_channel.rs @@ -8,7 +8,7 @@ use core::future::Future; use core::pin::Pin; use core::task::{Context, Poll}; -use heapless::binary_heap::Kind; +pub use heapless::binary_heap::{Kind, Max, Min}; use heapless::BinaryHeap; use crate::blocking_mutex::raw::RawMutex; @@ -344,8 +344,7 @@ where /// Establish a new bounded channel. For example, to create one with a NoopMutex: /// /// ``` - /// # use heapless::binary_heap::Max; - /// use embassy_sync::channel::priority::PriorityChannel; + /// use embassy_sync::priority_channel::{PriorityChannel, Max}; /// use embassy_sync::blocking_mutex::raw::NoopRawMutex; /// /// // Declare a bounded channel of 3 u32s.