That mpsc::Receiver does not have a function peek(&self) -> bool is very annoying. I think it is easy to build a wrapper that provides peek(&mut self) -> bool but I do not want to introduce a mutable self in this code section just to peek() when nothing needs to be mutated regardless of the result.
=> More informations about this toot | More toots from Teufelchen@hal9.ooo
@Teufelchen I think you can use interior mutability to manage the peeked item (setting which is otherwise a mutation), and put that Option in a (Ref)Cell.
The receiver is already not Sync, so you don't need fancy synchronization.
=> More informations about this toot | More toots from chrysn@chaos.social This content has been proxied by September (3851b).Proxy Information
text/gemini