pub trait LengthNum:
NumAssign
+ Bounded
+ Signed
+ PartialEq
+ PartialOrd
+ Clone
+ Copy
+ Debug
+ Zero {
type Hashable: Eq + Hash + Debug;
// Required methods
fn to_hashable(&self) -> Self::Hashable;
fn is_normal(&self) -> bool;
fn from_f32(v: f32) -> Self;
fn to_f32(self) -> f32;
fn from_i32(v: i32) -> Self;
// Provided methods
fn mul_f32(self, v: f32) -> Self { ... }
fn div_f32(self, v: f32) -> Self { ... }
fn mul_i32(self, v: i32) -> Self { ... }
fn div_i32(self, v: i32) -> Self { ... }
fn upper_bound(self, v: Self) -> Self { ... }
fn lower_bound(self, v: Self) -> Self { ... }
}Expand description
A generic length trait.
A more specific number type is needed for CSS handling.
In most cases f32 is what you need, but sometimes fixed-pointer types are preferred.
Required Associated Types§
Required Methods§
Sourcefn to_hashable(&self) -> Self::Hashable
fn to_hashable(&self) -> Self::Hashable
Convert to the hashable type.
Provided Methods§
Sourcefn upper_bound(self, v: Self) -> Self
fn upper_bound(self, v: Self) -> Self
Limit the number with an upper bound.
Sourcefn lower_bound(self, v: Self) -> Self
fn lower_bound(self, v: Self) -> Self
Limit the number with an lower bound.
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.