pub trait SpscCodec<T: Copy, const BYTES: usize>:
Send
+ Sync
+ 'static {
// Required methods
fn encode(value: T, destination: &mut [u8; BYTES]);
fn decode(source: &[u8; BYTES]) -> Option<T>;
}Expand description
Converts one value to and from a fixed-size atomic payload.
The producer calls encode. The consumer calls decode. Implementations
must decode every payload that they encode. A real-time codec must not
allocate in either function.
Required Methods§
fn encode(value: T, destination: &mut [u8; BYTES])
fn decode(source: &[u8; BYTES]) -> Option<T>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".