Skip to content

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

Merged
merged 1 commit into from
Aug 31, 2015
Merged

Conversation

Signez
Copy link
Contributor

@Signez Signez commented Aug 30, 2015

Probably not the best in town, but it seems to have correct perfs (near C++).

.map(|bite| {
bite.parse()
.ok()
.expect(&format!("failed to read {} as integer", bite))
Copy link

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

@TeXitoi
Copy link

TeXitoi commented Aug 31, 2015

Great! You may accelerate csa using unsafe code: carefully check that the data structure is bound consistent, and use get_unchecked{_mut}() in the bottleneck to avoid bound checks.

let mut input_line = String::new();
io::stdin().read_line(&mut input_line)
.ok()
.expect("failed to read connection line");
Copy link

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

Copy link
Contributor Author

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

Copy link

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.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Signez Signez force-pushed the rust branch 2 times, most recently from 7a8fc53 to e220cc0 Compare August 31, 2015 12:21
@Signez
Copy link
Contributor Author

Signez commented Aug 31, 2015

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 😉

@TeXitoi
Copy link

TeXitoi commented Aug 31, 2015

Cool :)

Thanks @TeXitoi for your insights on Rust code.
Tristramg added a commit that referenced this pull request Aug 31, 2015
Add a simple Rust version to the mix
@Tristramg Tristramg merged commit 94e1640 into trainline-eu:master Aug 31, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants