Re:Announcing Rust 1.26.2
by tatterdemalion on Tuesday June 05, 2018 @06:29PM
(#17242652)
The same code with `await` :)
let (reader, vec) = await { io.read_until(reader, b'\n', Vec::new() }?;
if vec.len() == 0 {
return Err(Error::new(ErrorKind::BrokenPipe, "broken pipe"));
}
let string = String::from_utf8(vec)?;
Re:Announcing Rust 1.26.2
by skolemtotem on Tuesday June 05, 2018 @06:19PM
(#17242578)
That's why Haskell has do-notation, and Rust has async/await. :)
Maybe you prefer that, but I prefer the code to describe just the business logic.