The following code can be compiled because there are no trait bound for T
:
let _ = mem::size_of::<Saturating<bool>>();
let _ = mem::size_of::<Wrapping<char>>();
Note that impl Saturating<bool>
and impl Wrapping<char>
are not implemented so these are largely meaningless.
On the other hand, the following code cannot be compiled because it does not satisfy the trait bound ZeroablePrimitive
:
let _ = mem::size_of::<NonZero<f64>>();
Why are there no trait bound which restrict a value ββto numeric types for T
on Saturating<T>
and Wrapping<T>
?