pub trait Alignable: Clone {
// Required methods
fn is_aligned(&self, other: &Self) -> bool;
fn align_with(&mut self, other: &mut Self);
}Expand description
A trait for aligning two items
Alignment is actually the meaning of preparation for interpolation.
For example, if we want to interpolate two VItems, we need to
align all their inner components like ComponentVec<VPoint> to the same length.
Required Methods§
Sourcefn is_aligned(&self, other: &Self) -> bool
fn is_aligned(&self, other: &Self) -> bool
Checking if two items are aligned
Sourcefn align_with(&mut self, other: &mut Self)
fn align_with(&mut self, other: &mut Self)
Aligning two items
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl Alignable for DVec3
impl Alignable for DVec3
fn align_with(&mut self, _other: &mut DVec3)
fn is_aligned(&self, _other: &DVec3) -> bool
Source§impl Alignable for MeshItem
impl Alignable for MeshItem
fn is_aligned(&self, other: &MeshItem) -> bool
fn align_with(&mut self, other: &mut MeshItem)
Source§impl Alignable for Polygon
impl Alignable for Polygon
fn is_aligned(&self, other: &Polygon) -> bool
fn align_with(&mut self, other: &mut Polygon)
Source§impl Alignable for Rectangle
impl Alignable for Rectangle
fn align_with(&mut self, _other: &mut Rectangle)
fn is_aligned(&self, _other: &Rectangle) -> bool
Source§impl Alignable for RegularPolygon
impl Alignable for RegularPolygon
fn is_aligned(&self, _other: &RegularPolygon) -> bool
fn align_with(&mut self, _other: &mut RegularPolygon)
Source§impl Alignable for Square
impl Alignable for Square
fn is_aligned(&self, _other: &Square) -> bool
fn align_with(&mut self, _other: &mut Square)
Source§impl Alignable for TypstText
impl Alignable for TypstText
fn is_aligned(&self, other: &TypstText) -> bool
fn align_with(&mut self, other: &mut TypstText)
Source§impl Alignable for VItem
impl Alignable for VItem
fn is_aligned(&self, other: &VItem) -> bool
fn align_with(&mut self, other: &mut VItem)
Source§impl<I, G> Alignable for Node<I, G>
impl<I, G> Alignable for Node<I, G>
Source§fn is_aligned(&self, other: &Node<I, G>) -> bool
fn is_aligned(&self, other: &Node<I, G>) -> bool
Whether both sides are already structurally compatible for direct
interpolation: payload presence must match positionally, sibling
counts must be equal, and every payload and child pair must satisfy
Alignable::is_aligned. This mirrors the Vec<T> blanket’s
pre-alignment contract; Alignable::align_with establishes this
state from mismatched trees.
Source§fn align_with(&mut self, other: &mut Node<I, G>)
fn align_with(&mut self, other: &mut Node<I, G>)
Align two trees for interpolation under one uniform rule: absence is filled with a transparent clone of the present side.
- Payload presence: when only one side carries an item, the
other side receives a transparent (
set_opacity(0.0)) clone of it, so lerping fades the payload in or out smoothly instead of jumping. - Payload pairs: when both sides carry items, they align with each other (vertex-level padding for point data).
- Children: unequal child counts are padded on both sides. A
non-empty list grows by repeating its own entries
(
resize_preserving_order_with_repeated_indices, matching theVec<T>: Alignableblanket); an empty list has nothing of its own to repeat, so it grows with transparent clones of the other side’s children — the same absence rule as payloads. Pairs recurse.