diff options
Diffstat (limited to 'embassy-sync/src')
| -rw-r--r-- | embassy-sync/src/channel.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/embassy-sync/src/channel.rs b/embassy-sync/src/channel.rs index 01db0d09a..79d3e0378 100644 --- a/embassy-sync/src/channel.rs +++ b/embassy-sync/src/channel.rs | |||
| @@ -263,6 +263,15 @@ impl<'ch, T> Future for DynamicReceiveFuture<'ch, T> { | |||
| 263 | } | 263 | } |
| 264 | } | 264 | } |
| 265 | 265 | ||
| 266 | impl<'ch, M: RawMutex, T, const N: usize> From<ReceiveFuture<'ch, M, T, N>> for DynamicReceiveFuture<'ch, T> | ||
| 267 | { | ||
| 268 | fn from(value: ReceiveFuture<'ch, M, T, N>) -> Self { | ||
| 269 | Self { | ||
| 270 | channel: value.channel, | ||
| 271 | } | ||
| 272 | } | ||
| 273 | } | ||
| 274 | |||
| 266 | /// Future returned by [`Channel::send`] and [`Sender::send`]. | 275 | /// Future returned by [`Channel::send`] and [`Sender::send`]. |
| 267 | #[must_use = "futures do nothing unless you `.await` or poll them"] | 276 | #[must_use = "futures do nothing unless you `.await` or poll them"] |
| 268 | pub struct SendFuture<'ch, M, T, const N: usize> | 277 | pub struct SendFuture<'ch, M, T, const N: usize> |
| @@ -321,6 +330,16 @@ impl<'ch, T> Future for DynamicSendFuture<'ch, T> { | |||
| 321 | 330 | ||
| 322 | impl<'ch, T> Unpin for DynamicSendFuture<'ch, T> {} | 331 | impl<'ch, T> Unpin for DynamicSendFuture<'ch, T> {} |
| 323 | 332 | ||
| 333 | impl<'ch, M: RawMutex, T, const N: usize> From<SendFuture<'ch, M, T, N>> for DynamicSendFuture<'ch, T> | ||
| 334 | { | ||
| 335 | fn from(value: SendFuture<'ch, M, T, N>) -> Self { | ||
| 336 | Self { | ||
| 337 | channel: value.channel, | ||
| 338 | message: value.message, | ||
| 339 | } | ||
| 340 | } | ||
| 341 | } | ||
| 342 | |||
| 324 | pub(crate) trait DynamicChannel<T> { | 343 | pub(crate) trait DynamicChannel<T> { |
| 325 | fn try_send_with_context(&self, message: T, cx: Option<&mut Context<'_>>) -> Result<(), TrySendError<T>>; | 344 | fn try_send_with_context(&self, message: T, cx: Option<&mut Context<'_>>) -> Result<(), TrySendError<T>>; |
| 326 | 345 | ||
