pub trait Half {
// Required method
fn half(&self) -> Self;
}Expand description
Provides a trait for types that can calculate half of their value.
The Half trait is used for types that can be evenly divided, returning a new instance of the same type
representing half of the original value. This is commonly used for types that represent measurements or sizes,
such as lengths or pixels, where halving is a frequent operation during layout calculations or animations.
Required Methods§
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.