-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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 RFCS-tracking-unimplementedStatus: The feature has not been implemented.Status: The feature has not been implemented.T-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(get_set_bit)]
This is a tracking issue for adding getters and setters of individual bits to all integral types.
Public API
This feature simplifies working with bitflags by adding to each integral type
- a
bitmethod retrieving whether the bit at some index (0is the least significant bit) is set, and - a
set_bitmethod for creating a new number, obtained form the old number by setting a specific bit to either zero or one.
impl /* u8 u16 u32 u64 u128 usize i8 i16 i32 i64 i128 isize */ {
pub const fn bit(self, index: u32) -> bool;
pub const fn set_bit(self, index: u32, value: bool) -> Self;
}Steps
- ACP: Adding
is_bit_setmethods for (u)int types libs-team#667 - Implementation: Implement
bitandset_bitfor integral types. #147696 - Final comment period (FCP)1
- Stabilization PR
Unresolved Questions
- Name of the setter might change to
with_bit_setor simplywith_bitto indicate more clearly that the setter creates an independent copy. See Implementbitandset_bitfor integral types. #147696 (comment)
Footnotes
bjoernager, MauriceKayser and Filiprogrammerbjoernager and FiliprogrammerFiliprogrammerFiliprogrammer
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 RFCS-tracking-unimplementedStatus: The feature has not been implemented.Status: The feature has not been implemented.T-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.