referrerpolicy=no-referrer-when-downgrade

Trait frame_support::pallet_prelude::One

source ·
pub trait One: Sized + Mul<Output = Self> {
    // Required method
    fn one() -> Self;

    // Provided methods
    fn set_one(&mut self) { ... }
    fn is_one(&self) -> bool
       where Self: PartialEq { ... }
}
Expand description

Defines a multiplicative identity element for Self.

§Laws

a * 1 = a       ∀ a ∈ Self
1 * a = a       ∀ a ∈ Self

Required Methods§

source

fn one() -> Self

Returns the multiplicative identity element of Self, 1.

§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.

Provided Methods§

source

fn set_one(&mut self)

Sets self to the multiplicative identity element of Self, 1.

source

fn is_one(&self) -> bool
where Self: PartialEq,

Returns true if self is equal to the multiplicative identity.

For performance reasons, it’s best to implement this manually. After a semver bump, this method will be required, and the where Self: PartialEq bound will be removed.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl One for f32

source§

fn one() -> f32

source§

fn is_one(&self) -> bool

source§

impl One for f64

source§

fn one() -> f64

source§

fn is_one(&self) -> bool

source§

impl One for i8

source§

fn one() -> i8

source§

fn is_one(&self) -> bool

source§

impl One for i16

source§

fn one() -> i16

source§

fn is_one(&self) -> bool

source§

impl One for i32

source§

fn one() -> i32

source§

fn is_one(&self) -> bool

source§

impl One for i64

source§

fn one() -> i64

source§

fn is_one(&self) -> bool

source§

impl One for i128

source§

fn one() -> i128

source§

fn is_one(&self) -> bool

source§

impl One for isize

source§

fn one() -> isize

source§

fn is_one(&self) -> bool

source§

impl One for u8

source§

fn one() -> u8

source§

fn is_one(&self) -> bool

source§

impl One for u16

source§

fn one() -> u16

source§

fn is_one(&self) -> bool

source§

impl One for u32

source§

fn one() -> u32

source§

fn is_one(&self) -> bool

source§

impl One for u64

source§

fn one() -> u64

source§

fn is_one(&self) -> bool

source§

impl One for u128

source§

fn one() -> u128

source§

fn is_one(&self) -> bool

source§

impl One for usize

source§

fn one() -> usize

source§

fn is_one(&self) -> bool

source§

impl One for BigUint

source§

impl One for FixedI64

source§

impl One for FixedI128

source§

impl One for FixedU64

source§

impl One for FixedU128

source§

impl One for PerU16

source§

impl One for Perbill

source§

impl One for Percent

source§

impl One for Permill

source§

impl One for Perquintill

source§

impl One for BigInt

source§

fn one() -> BigInt

source§

fn set_one(&mut self)

source§

fn is_one(&self) -> bool

source§

impl One for BigUint

source§

fn one() -> BigUint

source§

fn set_one(&mut self)

source§

fn is_one(&self) -> bool

§

impl One for U128

§

fn one() -> U128

§

impl One for U128

§

fn one() -> U128

§

impl One for U256

§

fn one() -> U256

§

impl One for U256

§

fn one() -> U256

§

impl One for U512

§

fn one() -> U512

§

impl One for U512

§

fn one() -> U512

§

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

§

fn one() -> CubicExtField<P>

§

fn is_one(&self) -> bool

§

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

§

fn one() -> QuadExtField<P>

§

fn is_one(&self) -> bool

§

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

§

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

§

fn is_one(&self) -> bool

source§

impl<T> One for Wrapping<T>
where T: One, Wrapping<T>: Mul<Output = Wrapping<T>>,

source§

fn set_one(&mut self)

source§

fn one() -> Wrapping<T>

source§

impl<T, D> One for TypeWithDefault<T, D>
where T: One, D: Get<T>,

Implementors§