embassy-sync

Crates

git

Versions

default

Flavors

Skip to main content

Module zerocopy_channel

Module zerocopy_channel 

Source
Expand description

A zero-copy queue for sending values between asynchronous tasks.

It can be used concurrently by a producer (sender) and a consumer (receiver), i.e. it is an “SPSC channel”.

This queue takes a Mutex type so that various targets can be attained. For example, a ThreadModeMutex can be used for single-core Cortex-M targets where messages are only passed between tasks running in thread mode. Similarly, a CriticalSectionMutex can also be used for single-core targets where messages are to be passed from exception mode e.g. out of an interrupt handler.

This module provides a bounded channel that has a limit on the number of messages that it can store. If this limit is reached, trying to send another message either waits or returns an error depending on the function.

Structs§

Channel
A bounded zero-copy channel for communicating between asynchronous tasks with backpressure.
ReceiveSlot
A slot for receiving in the channel.
Receiver
Receive-only access to a Channel.
SendSlot
A slot for sending in the channel
Sender
Send-only access to a Channel.