]>
git.lizzy.rs Git - rust.git/commit - src/tools/miri
Rollup merge of #82487 - CDirkx:const-socketaddr, r=m-ou-se
Constify methods of `std::net::SocketAddr`, `SocketAddrV4` and `SocketAddrV6`
The following methods are made unstable const under the `const_socketaddr` feature (https://github.com/rust-lang/rust/issues/82485):
```rust
// std::net
impl SocketAddr {
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 ip(&self) -> IpAddr;
pub const fn port(&self) -> u16;
}
impl SocketAddrV6 {
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;
}
```
Note: `SocketAddrV4::ip` and `SocketAddrV6::ip` use pointer casting and depend on the unstable feature `const_raw_ptr_deref`