4 ms·
Jesus. What would the 'correct' MIO production code look like without unwraps? Or is that a PhD research project, 'correctly' implementing this page of code fo
by ilaksh 12y ago
Jesus. What would the 'correct' MIO production code look like without unwraps? Or is that a PhD research project, 'correctly' implementing this page of code for 'production'?
- tupshin 12y agoIf this were not happening in main(), then the following would be one way of handling the errors. fn foo() -> Result<(),Error> { // Create an event loop let mut event_loop = try!(EventLoop::<(), u64>::new()); let sender = event_loop.channel(); for i in 0.. 5 { try!(sender.send(i)); } // Start it try!(event_loop.run(&mut BearHandler(0)); }
- hauleth 12y agoYou can always use `map`, `and` and `and_then`.