diff options
| author | Mathias <[email protected]> | 2022-10-11 09:19:55 +0200 |
|---|---|---|
| committer | Mathias <[email protected]> | 2022-10-11 09:19:55 +0200 |
| commit | aff265a7f59acf84216a8127df23fd89cb62edbd (patch) | |
| tree | 0e629de56f19b09efdb1226f9f7e5f1b1d00b28a /embassy-sync/src | |
| parent | 79cee7415110817b529a68848247a86708bcd6af (diff) | |
| parent | 9d5b524bb083310c2e1753859ebc9fca080a4238 (diff) | |
Merge branch 'master' of https://github.com/embassy-rs/embassy into embassy-stm32/rtc
Diffstat (limited to 'embassy-sync/src')
| -rw-r--r-- | embassy-sync/src/pubsub/publisher.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/embassy-sync/src/pubsub/publisher.rs b/embassy-sync/src/pubsub/publisher.rs index faa67d947..e1edc9eb9 100644 --- a/embassy-sync/src/pubsub/publisher.rs +++ b/embassy-sync/src/pubsub/publisher.rs | |||
| @@ -123,6 +123,14 @@ impl<'a, PSB: PubSubBehavior<T> + ?Sized, T: Clone> ImmediatePub<'a, PSB, T> { | |||
| 123 | pub fn try_publish(&self, message: T) -> Result<(), T> { | 123 | pub fn try_publish(&self, message: T) -> Result<(), T> { |
| 124 | self.channel.publish_with_context(message, None) | 124 | self.channel.publish_with_context(message, None) |
| 125 | } | 125 | } |
| 126 | |||
| 127 | /// The amount of messages that can still be published without having to wait or without having to lag the subscribers | ||
| 128 | /// | ||
| 129 | /// *Note: In the time between checking this and a publish action, other publishers may have had time to publish something. | ||
| 130 | /// So checking doesn't give any guarantees.* | ||
| 131 | pub fn space(&self) -> usize { | ||
| 132 | self.channel.space() | ||
| 133 | } | ||
| 126 | } | 134 | } |
| 127 | 135 | ||
| 128 | /// An immediate publisher that holds a dynamic reference to the channel | 136 | /// An immediate publisher that holds a dynamic reference to the channel |
