Trait Zero

Source
pub trait Zero: ConstantTimeEq + Sized {
    // Required method
    fn zero() -> Self;

    // Provided methods
    fn is_zero(&self) -> Choice { ... }
    fn set_zero(&mut self) { ... }
    fn zero_like(other: &Self) -> Self
       where Self: Clone { ... }
}
Expand description

Zero values.

Required Methods§

Source

fn zero() -> Self

The value 0.

Provided Methods§

Source

fn is_zero(&self) -> Choice

Determine if this value is equal to zero.

§Returns

If zero, returns Choice(1). Otherwise, returns Choice(0).

Source

fn set_zero(&mut self)

Set self to its additive identity, i.e. Self::zero.

Source

fn zero_like(other: &Self) -> Self
where Self: Clone,

Return the value 0 with the same precision as other.

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.

Implementors§

Source§

impl Zero for BoxedUint

Available on crate feature alloc only.
Source§

impl<T: ConstZero + ConstantTimeEq> Zero for T

Source§

impl<T: Zero> Zero for Wrapping<T>