aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-sync/src/pubsub/mod.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/embassy-sync/src/pubsub/mod.rs b/embassy-sync/src/pubsub/mod.rs
index 754747ab8..adbf8cf02 100644
--- a/embassy-sync/src/pubsub/mod.rs
+++ b/embassy-sync/src/pubsub/mod.rs
@@ -189,7 +189,7 @@ impl<M: RawMutex, T: Clone, const CAP: usize, const SUBS: usize, const PUBS: usi
189 } 189 }
190} 190}
191 191
192impl<M: RawMutex, T: Clone, const CAP: usize, const SUBS: usize, const PUBS: usize> PubSubBehavior<T> 192impl<M: RawMutex, T: Clone, const CAP: usize, const SUBS: usize, const PUBS: usize> SealedPubSubBehavior<T>
193 for PubSubChannel<M, T, CAP, SUBS, PUBS> 193 for PubSubChannel<M, T, CAP, SUBS, PUBS>
194{ 194{
195 fn get_message_with_context(&self, next_message_id: &mut u64, cx: Option<&mut Context<'_>>) -> Poll<WaitResult<T>> { 195 fn get_message_with_context(&self, next_message_id: &mut u64, cx: Option<&mut Context<'_>>) -> Poll<WaitResult<T>> {
@@ -421,7 +421,7 @@ pub enum Error {
421 421
422/// 'Middle level' behaviour of the pubsub channel. 422/// 'Middle level' behaviour of the pubsub channel.
423/// This trait is used so that Sub and Pub can be generic over the channel. 423/// This trait is used so that Sub and Pub can be generic over the channel.
424pub trait PubSubBehavior<T> { 424trait SealedPubSubBehavior<T> {
425 /// Try to get a message from the queue with the given message id. 425 /// Try to get a message from the queue with the given message id.
426 /// 426 ///
427 /// If the message is not yet present and a context is given, then its waker is registered in the subsriber wakers. 427 /// If the message is not yet present and a context is given, then its waker is registered in the subsriber wakers.
@@ -449,6 +449,13 @@ pub trait PubSubBehavior<T> {
449 fn unregister_publisher(&self); 449 fn unregister_publisher(&self);
450} 450}
451 451
452/// 'Middle level' behaviour of the pubsub channel.
453/// This trait is used so that Sub and Pub can be generic over the channel.
454#[allow(private_bounds)]
455pub trait PubSubBehavior<T>: SealedPubSubBehavior<T> {}
456
457impl<T, C: SealedPubSubBehavior<T>> PubSubBehavior<T> for C {}
458
452/// The result of the subscriber wait procedure 459/// The result of the subscriber wait procedure
453#[derive(Debug, Clone, PartialEq, Eq)] 460#[derive(Debug, Clone, PartialEq, Eq)]
454#[cfg_attr(feature = "defmt", derive(defmt::Format))] 461#[cfg_attr(feature = "defmt", derive(defmt::Format))]