Hacker News new | ask | show | jobs
by nothinkjustai 55 days ago
Looking at the code briefly, the first example could be written as

   let msg = timeout(Duration::from_secs(2), receiver.next()).await.ok()??;

   // not shown in article, but next line of code

   let Message::Text(frame) = msg_result.ok()? else {
      return None;
   };
Looks like the fixed the second issue with anyhow::Result<()>
1 comments

Thanks for sharing. I’ve learned something.