-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)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.disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.This issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.The final comment period is finished for this PR / Issue.
Description
Feature gate: #![feature(const_socketaddr)]
This is a tracking issue for constifying methods of std::net::SocketAddr
, SocketAddrV4
and SocketAddrV6
.
Public API
// std::net
impl SocketAddr {
pub const fn new(ip: IpAddr, port: u16) -> Self;
pub const fn ip(&self) -> IpAddr;
pub const fn port(&self) -> u16;
pub const fn is_ipv4(&self) -> bool;
pub const fn is_ipv6(&self) -> bool;
}
impl SocketAddrV4 {
pub const fn new(ip: Ipv4Addr, port: u16) -> Self;
pub const fn ip(&self) -> IpAddr;
pub const fn port(&self) -> u16;
}
impl SocketAddrV6 {
pub const fn new(ip: Ipv6Addr, port: u16, flowinfo: u32, scope_id: u32) -> Self;
pub const fn ip(&self) -> IpAddr;
pub const fn port(&self) -> u16;
pub const fn flowinfo(&self) -> u32;
pub const fn scope_id(&self) -> u32;
}
Steps / History
- Implementation: Constify methods of
std::net::SocketAddr
,SocketAddrV4
andSocketAddrV6
#82487 - Final commenting period (FCP)
- Stabilization PR
Unresolved Questions
The methods Resolved by #78802new
on all of the address could potentially also be made const, however there are two complications: getting the inner C representation of an IP address, and adding trailing zero bytes on windows.
Metadata
Metadata
Assignees
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)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.disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.This issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.The final comment period is finished for this PR / Issue.