Created
March 14, 2017 23:07
-
-
Save mnemnion/805df6023e93bc6180fac67191f24ec1 to your computer and use it in GitHub Desktop.
This file contains 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
// instead of having to do this all the time: | |
let maybe_utf8 = match stream.fill_buf() { | |
Ok(filehandle) => filehandle, | |
Err(_) => return captures, | |
}; | |
let phrase = match from_utf8(maybe_utf8) { | |
Ok(utf8) => String::from(utf8), | |
Err(_) => return captures, | |
}; | |
// why not this? | |
let buffer= presuming!(stream.fill_buff(), handle_file_access); | |
let phrase = presuming!(from_utf8(buffer), handle_utf8_conversion); | |
// then at the bottom | |
// This is the tricky part, and the below isn't very good. | |
fn handle_file_access() -> /* something goes here */ { | |
} | |
fn handle_utf8_conversion() -> {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment