Closed
Description
Feature gate: #![feature(wrapping_int_assign_impl)]
This is a tracking issue for adding basic integer operations to the Wrapping
type:
let mut value = Wrapping(2u8);
value += 3u8;
value -= 1u8;
value *= 2u8;
value /= 2u8;
value %= 2u8;
value ^= 255u8;
value |= 123u8;
value &= 2u8;
As well as
let mut value = Wrapping(2u8);
let _: Wrapping<u8> = value + 3u8;
let _: Wrapping<u8> = value - 1u8;
let _: Wrapping<u8> = value * 2u8;
let _: Wrapping<u8> = value / 2u8;
let _: Wrapping<u8> = value % 2u8;
let _: Wrapping<u8> = value ^ 255u8;
let _: Wrapping<u8> = value | 123u8;
let _: Wrapping<u8> = value & 2u8;
Steps / History
- Proposal for this implementation: Tracking issue for
core::ops::*<T>
onSaturating<T>
/Wrapping<T>
type #91586 - Implementation of
wrapping_int_assign_impl
Impl {Add,Sub,Mul,Div,Rem,BitXor,BitOr,BitAnd}Assign<$t> for Wrapping<$t> for rust 1.60.0 #93208 - Final comment period (FCP)
- Stabilization PR
Unresolved Questions
- Is this reasonable?
This is analog to the implementation for the Saturating
type here #92354