-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tracking Issue for IpvNAddr::{BITS, to_bits, from_bits}
(ip_bits
)
#113744
Comments
Add BITS, from_bits, to_bits to IP addresses ACP: rust-lang/libs-team#235 Tracking issue: rust-lang#113744
It would be nice to improve the docs here to be more specific about endianness, since we got questions about it in the PR after it landed. |
Adds explanation of how endianness is handled when converting `Ipv4Addr` and `Ipv6Addr` to and from bits. Addresses rust-lang#113744
Adds explanation of how endianness is handled when converting `Ipv4Addr` and `Ipv6Addr` to and from bits. Addresses rust-lang#113744
…s, r=cuviper Elaborate on ip_addr bit conversion endianness Adds explanation of how endianness is handled when converting `Ipv4Addr` and `Ipv6Addr` to and from bits. This is intended to unblock stabilization of the affected methods. Addresses rust-lang#113744
Rollup merge of rust-lang#118505 - CLEckhardt:update_ip_addr_bits_docs, r=cuviper Elaborate on ip_addr bit conversion endianness Adds explanation of how endianness is handled when converting `Ipv4Addr` and `Ipv6Addr` to and from bits. This is intended to unblock stabilization of the affected methods. Addresses rust-lang#113744
Is this ready for FCP now that the documentation issue has been addressed? Would love to see this stabilized. |
The docs say this:
So I hope it is okay if I ping @cuviper. (Terribly sorry if it is not.) |
It seems ready to me. Maybe @yungcomputerchair or @GrigorenkoPV can try writing a stabilization report? (I don't think I can start the actual FCP since I'm not part of the |
@rust-lang/libs-api:
These APIs were our own counterproposal to having leading_/trailing_zeros methods on the IP address types. See rust-lang/libs-team#235 (comment). |
Team member @dtolnay has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
Can someone please clarify, |
|
🔔 This is now entering its final comment period, as per the review above. 🔔 |
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. This will be merged soon. |
Note that this is only true if address is a netmask. A valid network prefix can (and often does) include trailing zeroes. |
Stabilise `IpvNAddr::{BITS, to_bits, from_bits}` (`ip_bits`) This completed FCP in rust-lang#113744. (Closes rust-lang#113744.) Stabilises the following APIs: ```rust impl Ipv4Addr { pub const BITS: u32 = 32; pub const fn from_bits(bits: u32) -> Ipv4Addr; pub const fn to_bits(self) -> u32; } impl Ipv6Addr { pub const BITS: u32 = 128; pub const fn from_bits(bits: u128) -> Ipv4Addr; pub const fn to_bits(self) -> u128; } ```
Stabilise `IpvNAddr::{BITS, to_bits, from_bits}` (`ip_bits`) This completed FCP in rust-lang#113744. (Closes rust-lang#113744.) Stabilises the following APIs: ```rust impl Ipv4Addr { pub const BITS: u32 = 32; pub const fn from_bits(bits: u32) -> Ipv4Addr; pub const fn to_bits(self) -> u32; } impl Ipv6Addr { pub const BITS: u32 = 128; pub const fn from_bits(bits: u128) -> Ipv4Addr; pub const fn to_bits(self) -> u128; } ```
Rollup merge of rust-lang#125551 - clarfonthey:ip-bits, r=jhpratt Stabilise `IpvNAddr::{BITS, to_bits, from_bits}` (`ip_bits`) This completed FCP in rust-lang#113744. (Closes rust-lang#113744.) Stabilises the following APIs: ```rust impl Ipv4Addr { pub const BITS: u32 = 32; pub const fn from_bits(bits: u32) -> Ipv4Addr; pub const fn to_bits(self) -> u32; } impl Ipv6Addr { pub const BITS: u32 = 128; pub const fn from_bits(bits: u128) -> Ipv4Addr; pub const fn to_bits(self) -> u128; } ```
Feature gate:
#![feature(ip_bits)]
This is a tracking issue for
IpvNAddr::{BITS, to_bits, from_bits}
.This API exists mostly so that users can be explicit about various bit operations which are useful for computing IP networks (see ACP linked below). For example,
IpvNAddr::BITS - ip.to_bits().trailing_zeros()
can be used to determine the network prefix length of a given address.Additionally, since
const
traits are still a long ways out, this provides aconst
version of the conversions to/from integers that people can use in the meantime.Public API
Steps / History
IpvNAddr::{BITS, to_bits, from_bits}
(ip_bits
) #125551Unresolved Questions
Footnotes
https://std-dev-guide.rust-lang.org/feature-lifecycle/api-change-proposals.html ↩
https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html ↩
The text was updated successfully, but these errors were encountered: