[][src]Trait nonzero_ext::NonZero

pub trait NonZero {
    type Primitive;
    fn new(n: Self::Primitive) -> Option<Self>
    where
        Self: Sized
;
fn get(self) -> Self::Primitive; }

A trait identifying a non-zero integral type. It is useful mostly in order to give to genericized helper functions as impl NonZero arguments.

Associated Types

type Primitive

The primitive type (e.g. u8) underlying this integral type.

Loading content...

Required methods

fn new(n: Self::Primitive) -> Option<Self> where
    Self: Sized

Creates a new non-zero object from an integer that might be zero.

fn get(self) -> Self::Primitive

Returns the value as a primitive type.

Loading content...

Implementations on Foreign Types

impl NonZero for NonZeroU8[src]

type Primitive = u8

impl NonZero for NonZeroU16[src]

type Primitive = u16

impl NonZero for NonZeroU32[src]

type Primitive = u32

impl NonZero for NonZeroU64[src]

type Primitive = u64

impl NonZero for NonZeroU128[src]

type Primitive = u128

impl NonZero for NonZeroUsize[src]

type Primitive = usize

impl NonZero for NonZeroI8[src]

type Primitive = i8

impl NonZero for NonZeroI16[src]

type Primitive = i16

impl NonZero for NonZeroI32[src]

type Primitive = i32

impl NonZero for NonZeroI64[src]

type Primitive = i64

impl NonZero for NonZeroI128[src]

type Primitive = i128

impl NonZero for NonZeroIsize[src]

type Primitive = isize

Loading content...

Implementors

Loading content...