Skip to main content

IsUnit

Trait IsUnit 

Source
pub trait IsUnit {
    // Required method
    fn is_unit(&self) -> bool;
}
Expand description

Determines whether a number is a unit of its ring, meaning that it has a multiplicative inverse in the same ring.

The Gaussian integers have four units, $\pm 1$ and $\pm i$; in a field every nonzero element is a unit. No type in this crate implements this trait; it exists for complex types downstream, like Gaussian integers.

Required Methods§

Source

fn is_unit(&self) -> bool

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl IsUnit for f32

Source§

fn is_unit(&self) -> bool

Determines whether a number is a unit: whether it is finite and nonzero, so that it has a multiplicative inverse. NaN and the infinities are not units.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl IsUnit for f64

Source§

fn is_unit(&self) -> bool

Determines whether a number is a unit: whether it is finite and nonzero, so that it has a multiplicative inverse. NaN and the infinities are not units.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl IsUnit for i8

Source§

fn is_unit(&self) -> bool

Determines whether a number is a unit: whether it is 1 or $-1$, the only integers with a multiplicative inverse.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl IsUnit for i16

Source§

fn is_unit(&self) -> bool

Determines whether a number is a unit: whether it is 1 or $-1$, the only integers with a multiplicative inverse.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl IsUnit for i32

Source§

fn is_unit(&self) -> bool

Determines whether a number is a unit: whether it is 1 or $-1$, the only integers with a multiplicative inverse.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl IsUnit for i64

Source§

fn is_unit(&self) -> bool

Determines whether a number is a unit: whether it is 1 or $-1$, the only integers with a multiplicative inverse.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl IsUnit for i128

Source§

fn is_unit(&self) -> bool

Determines whether a number is a unit: whether it is 1 or $-1$, the only integers with a multiplicative inverse.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl IsUnit for isize

Source§

fn is_unit(&self) -> bool

Determines whether a number is a unit: whether it is 1 or $-1$, the only integers with a multiplicative inverse.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl IsUnit for u8

Source§

fn is_unit(&self) -> bool

Determines whether a number is a unit: whether it is 1, the only unsigned integer with a multiplicative inverse.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl IsUnit for u16

Source§

fn is_unit(&self) -> bool

Determines whether a number is a unit: whether it is 1, the only unsigned integer with a multiplicative inverse.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl IsUnit for u32

Source§

fn is_unit(&self) -> bool

Determines whether a number is a unit: whether it is 1, the only unsigned integer with a multiplicative inverse.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl IsUnit for u64

Source§

fn is_unit(&self) -> bool

Determines whether a number is a unit: whether it is 1, the only unsigned integer with a multiplicative inverse.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl IsUnit for u128

Source§

fn is_unit(&self) -> bool

Determines whether a number is a unit: whether it is 1, the only unsigned integer with a multiplicative inverse.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl IsUnit for usize

Source§

fn is_unit(&self) -> bool

Determines whether a number is a unit: whether it is 1, the only unsigned integer with a multiplicative inverse.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Implementors§