pub trait Half {
// Required method
fn half(&self) -> Self;
}Expand description
Returns half of a value, for centering and midpoints.
Geometry code uses this trait to find midpoints and centers for each unit. For integers, the
result truncates toward zero, so half of 7 is 3.
§Examples
use gpui::{Half, px};
assert_eq!(7_i32.half(), 3);
assert_eq!(px(7.).half(), px(3.5));Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".