Wrapping<T> is a bit sorry-looking right now. let foo: Wrapping<u8> = 3; and Wrapping(1) + 1 are type errors, rather than assigning foo the value Wrapping(3) and having the value Wrapping(2) as I expected. You can't even print them.
use std::num::Wrapping;
fn main() {
let x: Wrapping<u8> = Wrapping(47);
println!("{}", x);
}
I asked in #rust and the consensus was the arithmetic is a little more controversial because of the potential for a combinatoric explosion of impls, but that std::fmt's fun toys are low-effort high-awesome and so warrant filing an issue.
Wrapping<T>is a bit sorry-looking right now.let foo: Wrapping<u8> = 3;andWrapping(1) + 1are type errors, rather than assigningfoothe valueWrapping(3)and having the valueWrapping(2)as I expected. You can't even print them.I asked in
#rustand the consensus was the arithmetic is a little more controversial because of the potential for a combinatoric explosion ofimpls, but thatstd::fmt's fun toys are low-effort high-awesome and so warrant filing an issue.