Tracking Issue for addr_parse_ascii feature · Issue #101035 · rust-lang/rust (original) (raw)

Feature gate: #![feature(addr_parse_ascii)]

This is a tracking issue for parsing network addresses (IP, Socket, etc) from a slice of bytes.

Internally the parser already works on bytes, this feature exposes publicly the ability to parse network address from a slice of bytes and therefor avoid the need to do utf8 validation in case one has only bytes.

Public API

impl IpAddr { pub fn parse_ascii(b: &[u8]) -> Result<Self, AddrParseError> { } impl Ipv4Addr { pub fn parse_ascii(b: &[u8]) -> Result<Self, AddrParseError> { } impl Ipv6Addr { pub fn parse_ascii(b: &[u8]) -> Result<Self, AddrParseError> { } impl SocketAddrV4 { pub fn parse_ascii(b: &[u8]) -> Result<Self, AddrParseError> { } impl SocketAddrV6 { pub fn parse_ascii(b: &[u8]) -> Result<Self, AddrParseError> { } impl SocketAddr { pub fn parse_ascii(b: &[u8]) -> Result<Self, AddrParseError> { }

Steps / History

Unresolved Questions

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html