• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #[cfg(feature = "std")]
main()2 fn main() {
3     use std::thread;
4     use std::time::Duration;
5 
6     let (sender, receiver) = oneshot::channel();
7     let t = thread::spawn(move || {
8         thread::sleep(Duration::from_millis(2));
9         sender.send(9u128).unwrap();
10     });
11     assert_eq!(receiver.recv(), Ok(9));
12     t.join().unwrap();
13 }
14 
15 #[cfg(not(feature = "std"))]
main()16 fn main() {
17     panic!("This example is only for when the \"sync\" feature is used");
18 }
19