pub trait ComputeSquaredDistance {
// Required method
fn compute_squared_distance(
&self,
other: &Self,
) -> Result<SquaredDistance, ()>;
}Expand description
A trait to compute squared distances between two animatable values.
This trait is derivable with #[derive(ComputeSquaredDistance)]. The derived
implementation uses a match expression with identical patterns for both
self and other, calling ComputeSquaredDistance::compute_squared_distance
on each fields of the values.
If a variant is annotated with #[animation(error)], the corresponding
match arm returns an error.
Trait bounds for type parameter Foo can be opted out of with
#[animation(no_bound(Foo))] on the type definition, trait bounds for
fields can be opted into with #[distance(field_bound)] on the field.
Required Methods§
Sourcefn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()>
fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()>
Computes the squared distance between two animatable values.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".