-
Notifications
You must be signed in to change notification settings - Fork 39
Add a simple Rust version to the mix #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
.map(|bite| { | ||
bite.parse() | ||
.ok() | ||
.expect(&format!("failed to read {} as integer", bite)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.unwrap()
will basically do that directly
Great! You may accelerate csa using unsafe code: carefully check that the data structure is bound consistent, and use |
let mut input_line = String::new(); | ||
io::stdin().read_line(&mut input_line) | ||
.ok() | ||
.expect("failed to read connection line"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can expect()
directly on a Result
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems I'm not bleeding edge enough…
error: use of unstable library feature 'result_expect': newly introduced
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, it's still unstable on 1.2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
7a8fc53
to
e220cc0
Compare
Thank you very much for this extensive review! As it is only my second Rust usage, I wasn't very confident… I owe you a beer 😉 |
Cool :) |
Thanks @TeXitoi for your insights on Rust code.
Add a simple Rust version to the mix
Probably not the best in town, but it seems to have correct perfs (near C++).