referrerpolicy=no-referrer-when-downgrade

Trait polkadot_sdk_frame::arithmetic::Zero

source ·
pub trait Zero: Sized + Add<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.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Zero for f32

source§

fn zero() -> f32

source§

fn is_zero(&self) -> bool

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 i16

source§

fn zero() -> i16

source§

fn is_zero(&self) -> bool

source§

impl Zero for i32

source§

fn zero() -> i32

source§

fn is_zero(&self) -> bool

source§

impl Zero for i64

source§

fn zero() -> i64

source§

fn is_zero(&self) -> bool

source§

impl Zero for i128

source§

impl Zero for isize

source§

impl Zero for u8

source§

fn zero() -> u8

source§

fn is_zero(&self) -> bool

source§

impl Zero for u16

source§

fn zero() -> u16

source§

fn is_zero(&self) -> bool

source§

impl Zero for u32

source§

fn zero() -> u32

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 usize

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 Zero for AutoSimd<[f32; 2]>

§

fn zero() -> AutoSimd<[f32; 2]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[f32; 4]>

§

fn zero() -> AutoSimd<[f32; 4]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[f32; 8]>

§

fn zero() -> AutoSimd<[f32; 8]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[f32; 16]>

§

fn zero() -> AutoSimd<[f32; 16]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[f64; 2]>

§

fn zero() -> AutoSimd<[f64; 2]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[f64; 4]>

§

fn zero() -> AutoSimd<[f64; 4]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[f64; 8]>

§

fn zero() -> AutoSimd<[f64; 8]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[i8; 2]>

§

fn zero() -> AutoSimd<[i8; 2]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[i8; 4]>

§

fn zero() -> AutoSimd<[i8; 4]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[i8; 8]>

§

fn zero() -> AutoSimd<[i8; 8]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[i8; 16]>

§

fn zero() -> AutoSimd<[i8; 16]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[i8; 32]>

§

fn zero() -> AutoSimd<[i8; 32]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[i16; 2]>

§

fn zero() -> AutoSimd<[i16; 2]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[i16; 4]>

§

fn zero() -> AutoSimd<[i16; 4]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[i16; 8]>

§

fn zero() -> AutoSimd<[i16; 8]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[i16; 16]>

§

fn zero() -> AutoSimd<[i16; 16]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[i16; 32]>

§

fn zero() -> AutoSimd<[i16; 32]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[i32; 2]>

§

fn zero() -> AutoSimd<[i32; 2]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[i32; 4]>

§

fn zero() -> AutoSimd<[i32; 4]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[i32; 8]>

§

fn zero() -> AutoSimd<[i32; 8]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[i32; 16]>

§

fn zero() -> AutoSimd<[i32; 16]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[i64; 2]>

§

fn zero() -> AutoSimd<[i64; 2]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[i64; 4]>

§

fn zero() -> AutoSimd<[i64; 4]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[i64; 8]>

§

fn zero() -> AutoSimd<[i64; 8]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[i128; 1]>

§

fn zero() -> AutoSimd<[i128; 1]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[i128; 2]>

§

fn zero() -> AutoSimd<[i128; 2]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[i128; 4]>

§

fn zero() -> AutoSimd<[i128; 4]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[isize; 2]>

§

fn zero() -> AutoSimd<[isize; 2]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[isize; 4]>

§

fn zero() -> AutoSimd<[isize; 4]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[isize; 8]>

§

fn zero() -> AutoSimd<[isize; 8]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[u8; 2]>

§

fn zero() -> AutoSimd<[u8; 2]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[u8; 4]>

§

fn zero() -> AutoSimd<[u8; 4]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[u8; 8]>

§

fn zero() -> AutoSimd<[u8; 8]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[u8; 16]>

§

fn zero() -> AutoSimd<[u8; 16]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[u8; 32]>

§

fn zero() -> AutoSimd<[u8; 32]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[u16; 2]>

§

fn zero() -> AutoSimd<[u16; 2]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[u16; 4]>

§

fn zero() -> AutoSimd<[u16; 4]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[u16; 8]>

§

fn zero() -> AutoSimd<[u16; 8]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[u16; 16]>

§

fn zero() -> AutoSimd<[u16; 16]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[u16; 32]>

§

fn zero() -> AutoSimd<[u16; 32]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[u32; 2]>

§

fn zero() -> AutoSimd<[u32; 2]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[u32; 4]>

§

fn zero() -> AutoSimd<[u32; 4]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[u32; 8]>

§

fn zero() -> AutoSimd<[u32; 8]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[u32; 16]>

§

fn zero() -> AutoSimd<[u32; 16]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[u64; 2]>

§

fn zero() -> AutoSimd<[u64; 2]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[u64; 4]>

§

fn zero() -> AutoSimd<[u64; 4]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[u64; 8]>

§

fn zero() -> AutoSimd<[u64; 8]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[u128; 1]>

§

fn zero() -> AutoSimd<[u128; 1]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[u128; 2]>

§

fn zero() -> AutoSimd<[u128; 2]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[u128; 4]>

§

fn zero() -> AutoSimd<[u128; 4]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[usize; 2]>

§

fn zero() -> AutoSimd<[usize; 2]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[usize; 4]>

§

fn zero() -> AutoSimd<[usize; 4]>

§

fn is_zero(&self) -> bool

§

impl Zero for AutoSimd<[usize; 8]>

§

fn zero() -> AutoSimd<[usize; 8]>

§

fn is_zero(&self) -> bool

§

impl Zero for U128

§

fn zero() -> U128

§

fn is_zero(&self) -> bool

§

impl Zero for U128

§

fn zero() -> U128

§

fn is_zero(&self) -> bool

§

impl Zero for U256

§

fn zero() -> U256

§

fn is_zero(&self) -> bool

§

impl Zero for U512

§

fn zero() -> U512

§

fn is_zero(&self) -> bool

§

impl Zero for WideF32x4

§

fn zero() -> WideF32x4

§

fn is_zero(&self) -> bool

§

impl Zero for WideF32x8

§

fn zero() -> WideF32x8

§

fn is_zero(&self) -> bool

§

impl Zero for WideF64x4

§

fn zero() -> WideF64x4

§

fn is_zero(&self) -> bool

§

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

§

fn zero() -> DenseMultilinearExtension<F>

§

fn is_zero(&self) -> bool

§

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 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, 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<P> Zero for CubicExtField<P>
where P: CubicExtConfig,

§

fn zero() -> CubicExtField<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

§

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 QuadExtField<P>
where P: QuadExtConfig,

§

fn zero() -> QuadExtField<P>

§

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

source§

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

source§

fn is_zero(&self) -> bool

source§

fn set_zero(&mut self)

source§

fn zero() -> Wrapping<T>

source§

impl<T> Zero for DualQuaternion<T>
where T: SimdRealField, <T as SimdValue>::Element: SimdRealField,

source§

impl<T> Zero for Quaternion<T>
where T: SimdRealField, <T as SimdValue>::Element: SimdRealField,

source§

impl<T> Zero for Complex<T>
where T: Clone + Num,

source§

fn zero() -> Complex<T>

source§

fn is_zero(&self) -> bool

source§

fn set_zero(&mut self)

source§

impl<T> Zero for Ratio<T>
where T: Clone + Integer,

source§

fn zero() -> Ratio<T>

source§

fn is_zero(&self) -> bool

source§

fn set_zero(&mut self)

§

impl<T, D> Zero for TypeWithDefault<T, D>
where T: Zero + PartialEq, D: Get<T>,

§

fn zero() -> TypeWithDefault<T, D>

§

fn is_zero(&self) -> bool

source§

impl<T, R, C> Zero for Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer>
where R: DimName, C: DimName, T: Scalar + Zero + ClosedAdd, DefaultAllocator: Allocator<T, R, C>,

source§

fn zero() -> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer>

source§

fn is_zero(&self) -> bool

Implementors§

§

impl Zero for polkadot_sdk_frame::hashing::U256

§

impl Zero for polkadot_sdk_frame::hashing::U512

§

impl Zero for Weight

§

impl Zero for polkadot_sdk_frame::arithmetic::biguint::BigUint

§

impl Zero for FixedI64

§

impl Zero for FixedI128

§

impl Zero for FixedU64

§

impl Zero for FixedU128

§

impl Zero for PerU16

§

impl Zero for Perbill

§

impl Zero for Percent

§

impl Zero for Permill

§

impl Zero for Perquintill