]> git.lizzy.rs Git - rust.git/commit
Rollup merge of #94890 - marmeladema:ip-addr-try-from-bytes, r=joshtriplett
authorMatthias Krüger <matthias.krueger@famsik.de>
Mon, 29 Aug 2022 04:34:41 +0000 (06:34 +0200)
committerGitHub <noreply@github.com>
Mon, 29 Aug 2022 04:34:41 +0000 (06:34 +0200)
commit52016a10053bcdd6c52b60cdcab8c316d26f4172
treee3013a0518523725850f71ffbdf102aa4cca244a
parent1ea4efd0656599f824e2567a5b7a95454f701c03
parent8bb4b5f44c8b7c811e2075022e5205f927287e0a
Rollup merge of #94890 - marmeladema:ip-addr-try-from-bytes, r=joshtriplett

Support parsing IP addresses from a byte string

Fixes #94821

The goal is to be able to parse addresses from a byte string without requiring to do any utf8 validation. Since internally the parser already works on byte strings, this should be possible and I personally already needed this in the past too.

~~I used the proposed approach from the issue by implementing `TryFrom<&'a [u8]>` for all 6 address types (3 ip address types and 3 socket address types). I believe implementing stable traits for stable types is insta-stable so this will probably need an FCP?~~

Switched to an unstable inherent method approach called `parse_ascii` as requested.

cc ``````@jyn514``````