channels.rs 339 B

12345678910111213141516171819
  1. use futures_channel::mpsc::unbounded;
  2. #[async_std::test]
  3. async fn channels() {
  4. let (sender, mut receiver) = unbounded::<u32>();
  5. // drop(sender);
  6. match receiver.try_next() {
  7. Ok(a) => {
  8. dbg!(a);
  9. }
  10. Err(no) => {
  11. dbg!(no);
  12. }
  13. }
  14. sender.unbounded_send(1).unwrap();
  15. }