Guest User

Untitled

a guest
Feb 16th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. fn main() {
  2. tokio::run_async(async {
  3. let resps = Arc::new(Mutex::new(HashMap::new()));
  4. let resps_inner = resps.clone();
  5. tokio::spawn_async(async move {
  6. while let Some(Ok((id, data))) = await!(rx_q.next()) {
  7. let mut resps = resps_inner.lock().unwrap();
  8. resps.insert(id, data);
  9. }
  10. });
  11. tokio::spawn_async(async move {
  12. while let Some(Ok(msg)) = await!(rx_in.next()) {
  13. let mut resps = resps.lock().unwrap();
  14. unimplemented!(); /// ...
  15. }
  16. });
  17. })
  18. }
Add Comment
Please, Sign In to add comment