pub trait Along {
type Unit;
// Required methods
fn along(&self, axis: Axis) -> Self::Unit;
fn apply_along(
&self,
axis: Axis,
f: impl FnOnce(Self::Unit) -> Self::Unit,
) -> Self;
}Expand description
Reads and updates the value along one Axis.
Point and Size implement this trait. The horizontal axis is x for a point and
width for a size. The vertical axis is y and height.
§Examples
use gpui::{Along, Axis, point, px};
let mut position = point(px(10.), px(20.));
position = position.apply_along(Axis::Vertical, |y| y + px(5.));
assert_eq!(position.along(Axis::Vertical), px(25.));Required Associated Types§
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".