Created
January 19, 2018 06:50
-
-
Save djg/acc3c4c34db9b4578c03713574719aa7 to your computer and use it in GitHub Desktop.
Rust future/result and_then style control flow.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open_server_stream().ok() | |
.and_then(|stream| UnixStream::from_stream(stream, &handle).ok()) | |
.and_then(|stream| bind_and_send_client(stream, &handle, &tx_rpc)) | |
.ok_or_else(|| io::Error::new( | |
io::ErrorKind::Other, | |
"Failed to open stream and create rpc." | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment