ToZero

Trait ToZero 

Source
pub trait ToZero<T>:
    Sized
    + PartialEq
    + Copy {
    // Required method
    fn to_zero() -> T;
}
Available on crate feature to_zero only.
Expand description

Trait for implementing the null value of types.

assert_eq!(u8::to_zero(), u8::MIN);
assert_eq!(i16::to_zero(), 0_i16);
assert_eq!(u32::to_zero(), u32::MIN);
assert_eq!(i64::to_zero(), 0_i64);
assert_eq!(usize::to_zero(), usize::MIN);
assert_eq!(i128::to_zero(), 0_i128);

Required Methods§

Source

fn to_zero() -> T

Returns zero of types.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl ToZero<i8> for i8

Available on crate features to_min or to_max or to_zero only.
Source§

fn to_zero() -> i8

Zero value (i8) for type i8.

Source§

impl ToZero<i16> for i16

Available on crate features to_min or to_max or to_zero only.
Source§

fn to_zero() -> i16

Zero value (i16) for type i16.

Source§

impl ToZero<i32> for i32

Available on crate features to_min or to_max or to_zero only.
Source§

fn to_zero() -> i32

Zero value (i32) for type i32.

Source§

impl ToZero<i64> for i64

Available on crate features to_min or to_max or to_zero only.
Source§

fn to_zero() -> i64

Zero value (i64) for type i64.

Source§

impl ToZero<i128> for i128

Available on crate features to_min or to_max or to_zero only.
Source§

fn to_zero() -> i128

Zero value (i128) for type i128.

Source§

impl ToZero<isize> for isize

Available on crate features to_min or to_max or to_zero only.
Source§

fn to_zero() -> isize

Zero value (isize) for type isize.

Source§

impl ToZero<u8> for u8

Available on crate features to_min or to_max or to_zero only.
Source§

fn to_zero() -> u8

Zero value (u8) for type u8.

Source§

impl ToZero<u16> for u16

Available on crate features to_min or to_max or to_zero only.
Source§

fn to_zero() -> u16

Zero value (u16) for type u16.

Source§

impl ToZero<u32> for u32

Available on crate features to_min or to_max or to_zero only.
Source§

fn to_zero() -> u32

Zero value (u32) for type u32.

Source§

impl ToZero<u64> for u64

Available on crate features to_min or to_max or to_zero only.
Source§

fn to_zero() -> u64

Zero value (u64) for type u64.

Source§

impl ToZero<u128> for u128

Available on crate features to_min or to_max or to_zero only.
Source§

fn to_zero() -> u128

Zero value (u128) for type u128.

Source§

impl ToZero<usize> for usize

Available on crate features to_min or to_max or to_zero only.
Source§

fn to_zero() -> usize

Zero value (usize) for type usize.

Implementors§