Trait sp_runtime::traits::Zero

source ·
pub trait Zero: Sized + Add<Self, Output = Self> {
    // Required methods
    fn zero() -> Self;
    fn is_zero(&self) -> bool;

    // Provided method
    fn set_zero(&mut self) { ... }
}
Expand description

Defines an additive identity element for Self.

Laws

a + 0 = a       ∀ a ∈ Self
0 + a = a       ∀ a ∈ Self

Required Methods§

source

fn zero() -> Self

Returns the additive identity element of Self, 0.

Purity

This function should return the same result at all times regardless of external mutable state, for example values stored in TLS or in static muts.

source

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.

Provided Methods§

source

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.

Implementations on Foreign Types§

source§

impl Zero for u16

source§

fn zero() -> u16

source§

fn is_zero(&self) -> bool

source§

impl Zero for i16

source§

fn zero() -> i16

source§

fn is_zero(&self) -> bool

source§

impl Zero for isize

source§

impl Zero for u32

source§

fn zero() -> u32

source§

fn is_zero(&self) -> bool

source§

impl Zero for i128

source§

impl Zero for i64

source§

fn zero() -> i64

source§

fn is_zero(&self) -> bool

source§

impl Zero for usize

source§

impl Zero for u8

source§

fn zero() -> u8

source§

fn is_zero(&self) -> bool

source§

impl Zero for f32

source§

fn zero() -> f32

source§

fn is_zero(&self) -> bool

source§

impl Zero for u64

source§

fn zero() -> u64

source§

fn is_zero(&self) -> bool

source§

impl Zero for u128

source§

impl Zero for f64

source§

fn zero() -> f64

source§

fn is_zero(&self) -> bool

source§

impl Zero for i8

source§

fn zero() -> i8

source§

fn is_zero(&self) -> bool

source§

impl Zero for i32

source§

fn zero() -> i32

source§

fn is_zero(&self) -> bool

source§

impl<T> Zero for Wrapping<T>where T: Zero, Wrapping<T>: Add<Wrapping<T>, Output = Wrapping<T>>,

source§

fn is_zero(&self) -> bool

source§

fn set_zero(&mut self)

source§

fn zero() -> Wrapping<T>

§

impl Zero for U256

§

fn zero() -> U256

§

fn is_zero(&self) -> bool

§

impl Zero for U128

§

fn zero() -> U128

§

fn is_zero(&self) -> bool

§

impl Zero for U512

§

fn zero() -> U512

§

fn is_zero(&self) -> bool

source§

impl Zero for BigInt

source§

fn zero() -> BigInt

source§

fn set_zero(&mut self)

source§

fn is_zero(&self) -> bool

source§

impl Zero for BigUint

source§

fn zero() -> BigUint

source§

fn set_zero(&mut self)

source§

fn is_zero(&self) -> bool

§

impl<P, const N: usize> Zero for Fp<P, N>where P: FpConfig<N>,

§

fn zero() -> Fp<P, N>

§

fn is_zero(&self) -> bool

§

impl<P> Zero for CubicExtField<P>where P: CubicExtConfig,

§

fn zero() -> CubicExtField<P>

§

fn is_zero(&self) -> bool

§

impl<P> Zero for QuadExtField<P>where P: QuadExtConfig,

§

fn zero() -> QuadExtField<P>

§

fn is_zero(&self) -> bool

§

impl<F, T> Zero for SparsePolynomial<F, T>where F: Field, T: Term,

§

fn zero() -> SparsePolynomial<F, T>

Returns the zero polynomial.

§

fn is_zero(&self) -> bool

Checks if the given polynomial is zero.

§

impl<F> Zero for SparsePolynomial<F>where F: Field,

§

fn zero() -> SparsePolynomial<F>

Returns the zero polynomial.

§

fn is_zero(&self) -> bool

Checks if the given polynomial is zero.

§

impl<F> Zero for DensePolynomial<F>where F: Field,

§

fn zero() -> DensePolynomial<F>

Returns the zero polynomial.

§

fn is_zero(&self) -> bool

Checks if the given polynomial is zero.

§

impl<F> Zero for SparseMultilinearExtension<F>where F: Field,

§

fn zero() -> SparseMultilinearExtension<F>

§

fn is_zero(&self) -> bool

§

impl<F> Zero for DenseMultilinearExtension<F>where F: Field,

§

fn zero() -> DenseMultilinearExtension<F>

§

fn is_zero(&self) -> bool

§

impl<P> Zero for Projective<P>where P: SWCurveConfig,

§

fn zero() -> Projective<P>

Returns the point at infinity, which always has Z = 0.

§

fn is_zero(&self) -> bool

Checks whether self.z.is_zero().

§

impl<P> Zero for Projective<P>where P: TECurveConfig,

§

fn zero() -> Projective<P>

§

fn is_zero(&self) -> bool

§

impl<P> Zero for PairingOutput<P>where P: Pairing,

§

fn zero() -> PairingOutput<P>

The identity element, or “zero”, of the group is the identity element of the multiplicative group of the underlying field, i.e., P::TargetField::one().

§

fn is_zero(&self) -> bool

source§

impl Zero for Weight

Implementors§