Closed
Description
Feature gate: #![feature(saturating_int_assign_impl)]
This is a tracking issue for adding basic integer operations to the Saturating
Wrapping type:
let mut value = Saturating(2u8);
value += 3u8;
value -= 1u8;
value *= 2u8;
value /= 2u8;
value %= 2u8;
value ^= 255u8;
value |= 123u8;
value &= 2u8;
As well as
See #93208 (comment). No longer within the scope of this feature:
let mut value = Saturating(2u8);
let _: Saturating<u8> = value + 3u8;
let _: Saturating<u8> = value - 1u8;
let _: Saturating<u8> = value * 2u8;
let _: Saturating<u8> = value / 2u8;
let _: Saturating<u8> = value % 2u8;
let _: Saturating<u8> = value ^ 255u8;
let _: Saturating<u8> = value | 123u8;
let _: Saturating<u8> = value & 2u8;
Steps / History
- Implement basic
Saturating
type Tracking Issue forSaturating
type #87920 - Proposal for this implementation: Tracking issue for
core::ops::*<T>
onSaturating<T>
/Wrapping<T>
type #91586 - Implementation of
saturating_int_assign_impl
Add {Add,Sub,Mul,Div,Rem,BitXor,BitOr,BitAnd}{,Assign}<$t> to Saturat… #92356- Reduce
saturating_int_assign_impl
Unimpl {Add,Sub,Mul,Div,Rem,BitXor,BitOr,BitAnd}<$t> for Saturating<$t> #93353
- Reduce
- Final comment period (FCP)
- Stabilization PR
Unresolved Questions
- Is this reasonable?
An implementation for the Wrapping
type is planned as follow up.