Trait style::values::distance::ComputeSquaredDistance
source · 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.
Object Safety§
This trait is not object safe.