heapless/cfail/ui/not-send.rs
Emil Fresk 6fdcc4fb99 New SPSC queue, now safe and much simpler
This commit implements a new, simplified, SPSC that does not have the
reported issues (e.g. not properly wrapping the indexes for non
powers-of-2), and the support for multiple different index sizes has
been removed for simplicity.
2021-04-18 19:18:56 +02:00

25 lines
461 B
Rust

//! Collections of non-`Send`-able things are *not* `Send`
use core::marker::PhantomData;
use heapless::{
spsc::{Consumer, Producer, Queue},
HistoryBuffer, Vec,
};
type NotSend = PhantomData<*const ()>;
fn is_send<T>()
where
T: Send,
{
}
fn main() {
is_send::<Consumer<NotSend, 4>>();
is_send::<Producer<NotSend, 4>>();
is_send::<Queue<NotSend, 4>>();
is_send::<Vec<NotSend, 4>>();
is_send::<HistoryBuffer<NotSend, 4>>();
}