Skip to main content

leak_playground_std/
sync.rs

1//! Possible [`std::sync`] additions and replacements.
2
3mod arc;
4
5pub mod mpsc {
6    use std::sync::mpsc;
7
8    use crate::marker::Forget;
9
10    pub fn rendezvous_channel<T>() -> (mpsc::SyncSender<T>, mpsc::Receiver<T>) {
11        mpsc::sync_channel(0)
12    }
13
14    pub fn sync_channel<T: Forget>(bound: usize) -> (mpsc::SyncSender<T>, mpsc::Receiver<T>) {
15        mpsc::sync_channel(bound)
16    }
17
18    pub fn channel<T: Forget>() -> (mpsc::Sender<T>, mpsc::Receiver<T>) {
19        mpsc::channel()
20    }
21
22    pub unsafe fn sync_channel_unchecked<T>(
23        bound: usize,
24    ) -> (mpsc::SyncSender<T>, mpsc::Receiver<T>) {
25        mpsc::sync_channel(bound)
26    }
27
28    pub unsafe fn channel_unchecked<T>() -> (mpsc::Sender<T>, mpsc::Receiver<T>) {
29        mpsc::channel()
30    }
31}
32
33pub use arc::*;