-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Open
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
Feature gate: #![feature(ip_as_octets)]
This is a tracking issue for enabling reference access to IpAddr, Ipv4Addr, and Ipv6Addr contents. Previously, only an array copy was exposed via .octets().
Public API
impl core::net::IpAddr {
pub const fn as_octets(&self) -> &[u8];
}
impl core::net::Ipv4Addr {
pub const fn as_octets(&self) -> &[u8; 4];
}
impl core::net::Ipv6Addr {
pub const fn as_octets(&self) -> &[u8; 16];
}Steps / History
- ACP: ref access to
core::net::Ip*Addroctet bytes,impl AsRef<[u8]> for core::net::Ip*Addrlibs-team#535 - Implementation: libcore/net:
IpAddr::as_octets()#136609 - Final comment period (FCP)
- Stabilization PR
Unresolved Questions
- @tgross35 offered a potential alternative in the ACP: that we instead provide
#[repr(transparent)]for these types and document layout stability, leaving transmutation to a byte slice to third-party libraries.
cxw620 and strohel
Metadata
Metadata
Assignees
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.