Skip to content
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

Basic error handling for en– and decoding #3

Merged
merged 2 commits into from Jul 6, 2016
Merged

Conversation

urschrei
Copy link
Member

encode_coordinates() and decode_polyline() now cope with the
possibility that a u32 can't be encoded as a char, or that your .nth()
operation could fail because index is longer than str
(the latter is unlikely, but here we are).

This also means that your public functions now return Result types,
which allows their consumers to be a bit more flexible.

encode_coordinates() and decode_polyline() now cope with the
possibility that a u32 can't be encoded as a char, or that your .nth()
operation could fail because index is longer than the iterator
(the latter is unlikely, but here we are)

This also means that your public functions now return Result types,
which allows their consumers to be a bit more flexible.
This removes some manual assignments, manual indexing, and
substitutes a proper check for emptiness
@tmcw
Copy link
Collaborator

tmcw commented Jul 6, 2016

Amazing, thanks! This teaches me a new part of Rust :)

@tmcw tmcw merged commit 2ed6c8a into georust:master Jul 6, 2016
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.

None yet

2 participants