Implement FromStr for IpAddr and SocketAddr#8336
Closed
stepancheg wants to merge 2 commits intorust-lang:masterfrom
Closed
Implement FromStr for IpAddr and SocketAddr#8336stepancheg wants to merge 2 commits intorust-lang:masterfrom
stepancheg wants to merge 2 commits intorust-lang:masterfrom
Conversation
Better than that in rt::uv::net, because it: * handles invalid input explicitly, without fail!() * parses socket address, not just IP * handles various ipv4-in-ipv6 addresses, like 2001:db8:122:344::192.0.2.33 (see http://tools.ietf.org/html/rfc6052 for example) * rejects output like `127.0000000.0.1` * does not allocate heap memory * have unit tests
src/libstd/rt/io/net/ip.rs
Outdated
Contributor
There was a problem hiding this comment.
Just FYI, small spelling mistake here: "read_atomially" should be "read_atomically".
Contributor
Author
|
Fixed typo in method name, thanks to @andrew-d. |
Contributor
|
Awesome! Mind also fixing a mistake in ToStr? https://github.com/stepancheg/rust/blob/58b11229e563da705e2579821b8c3fe1fa799c52/src/libstd/rt/io/net/ip.rs#L46 should be |
Contributor
Author
bors
added a commit
that referenced
this pull request
Aug 9, 2013
FromStr implemented from scratch. It is overengineered a bit, however. Old implementation handles errors by fail!()-ing. And it has bugs, like it accepts `127.0.0.1::127.0.0.1` as IPv6 address, and does not handle all ipv4-in-ipv6 schemes. So I decided to implement parser from scratch.
flip1995
pushed a commit
to flip1995/rust
that referenced
this pull request
Oct 6, 2022
[`needless_return`] Recursively remove unneeded semicolons fix rust-lang#8336, fix rust-lang#8156, fix rust-lang/rust-clippy#7358, fix rust-lang#9192, fix rust-lang/rust-clippy#9503 changelog: [`needless_return`] Recursively remove unneeded semicolons For now the suggestion about removing the semicolons are hidden because they would be very noisy and should be obvious if the user wants to apply the lint manually instead of using `--fix`. This could be an issue for beginner, but haven't found better way to display it.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FromStr implemented from scratch.
It is overengineered a bit, however.
Old implementation handles errors by fail!()-ing. And it has bugs, like it accepts
127.0.0.1::127.0.0.1as IPv6 address, and does not handle all ipv4-in-ipv6 schemes. So I decided to implement parser from scratch.