postage/channels.rs
1pub mod barrier;
2pub mod broadcast;
3pub mod dispatch;
4pub mod mpsc;
5pub mod oneshot;
6pub mod watch;
7
8use std::{cell::Cell, marker::Sync};
9
10use static_assertions::{assert_impl_all, assert_not_impl_all};
11
12// Testing types for static assertions on channel endpoints
13// Some channel implementations have unsafe Sync impls,
14// even if their generic type does not impl Sync (or &T impl Send)
15// In order to pin down this behavior, these testing messages
16// are used as generics in static assertions.
17#[allow(dead_code)]
18struct SendMessage {
19 cell: Cell<u8>,
20}
21
22assert_impl_all!(SendMessage: Send);
23assert_not_impl_all!(SendMessage: Sync);
24
25#[allow(dead_code)]
26struct SendSyncMessage;
27assert_impl_all!(SendSyncMessage: Send, Sync);