pub trait One: Sized {
// Required methods
fn one() -> Self;
fn set_one(&mut self);
fn is_one(&self) -> bool;
}Expand description
Defines a multiplicative identity element for Self.
A pure identity-value trait, decoupled from Mul for the
same reason as Zero: 1 is equally the identity under division
(a / 1 = a), so privileging Mul is arbitrary. Consumers state what they
need (T: One + Mul, T: One + Div, …); full numeric code takes
Num.
§Laws
a * 1 = a ∀ a ∈ Self
1 * a = a ∀ a ∈ SelfRequired Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".