mirror of
https://github.com/rust-embedded/heapless.git
synced 2025-09-30 05:50:29 +00:00

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.
25 lines
461 B
Rust
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>>();
|
|
}
|