How to Use std

:num for Number-Related Traits (NonZero, Wrapping, etc.)

Import types from std::num to enforce non-zero values or enable wrapping arithmetic safely.

Use std::num types like NonZeroU32 or Wrapping<i32> by importing them from std::num and instantiating them with their constructors or conversion methods. These types enforce invariants (like non-zero) or define specific arithmetic behavior (like wrapping) at compile time or runtime.

use std::num::{NonZeroU32, Wrapping};

fn main() {
    let non_zero = NonZeroU32::new(42).unwrap();
    let wrapped = Wrapping(100u8) + Wrapping(200u8);
    println!("{non_zero}, {wrapped}");
}