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§

source

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.

Implementations on Foreign Types§

source§

impl ComputeSquaredDistance for f32

source§

impl ComputeSquaredDistance for f64

source§

impl ComputeSquaredDistance for i16

source§

impl ComputeSquaredDistance for i32

source§

impl ComputeSquaredDistance for u16

source§

impl<T> ComputeSquaredDistance for Option<T>

source§

impl<T> ComputeSquaredDistance for Box<T>

source§

impl<T> ComputeSquaredDistance for Size2D<T>

Implementors§

source§

impl ComputeSquaredDistance for AnimationValue

source§

impl ComputeSquaredDistance for T

source§

impl ComputeSquaredDistance for AngleOrPercentage

source§

impl ComputeSquaredDistance for NumberOrPercentage

source§

impl ComputeSquaredDistance for Impossible

source§

impl ComputeSquaredDistance for ArcSize

source§

impl ComputeSquaredDistance for ArcSweep

source§

impl ComputeSquaredDistance for ByTo

source§

impl ComputeSquaredDistance for FillRule

source§

impl ComputeSquaredDistance for ShapeBox

source§

impl ComputeSquaredDistance for ShapeGeometryBox

source§

impl ComputeSquaredDistance for VerticalAlignKeyword

source§

impl ComputeSquaredDistance for AnchorSizeKeyword

source§

impl ComputeSquaredDistance for RaySize

source§

impl ComputeSquaredDistance for AnchorSideKeyword

source§

impl ComputeSquaredDistance for FontSizeKeyword

source§

impl ComputeSquaredDistance for CoordBox

source§

impl ComputeSquaredDistance for DProperty

source§

impl ComputeSquaredDistance for TransformBox

source§

impl ComputeSquaredDistance for AbsoluteColor

source§

impl ComputeSquaredDistance for style::properties::generated::longhands::background_position_x::computed_value::OwnedList<<T as ToAnimatedValue>::AnimatedValue>

source§

impl ComputeSquaredDistance for style::properties::generated::longhands::background_position_y::computed_value::OwnedList<<T as ToAnimatedValue>::AnimatedValue>

source§

impl ComputeSquaredDistance for style::properties::generated::longhands::background_size::computed_value::OwnedList<<T as ToAnimatedValue>::AnimatedValue>

source§

impl ComputeSquaredDistance for style::properties::generated::longhands::box_shadow::computed_value::OwnedList<<T as ToAnimatedValue>::AnimatedValue>

source§

impl ComputeSquaredDistance for style::properties::generated::longhands::filter::computed_value::OwnedList<<T as ToAnimatedValue>::AnimatedValue>

source§

impl ComputeSquaredDistance for style::properties::generated::longhands::text_shadow::computed_value::OwnedList<<T as ToAnimatedValue>::AnimatedValue>

source§

impl ComputeSquaredDistance for InnerMatrix2D

source§

impl ComputeSquaredDistance for MatrixDecomposed2D

source§

impl ComputeSquaredDistance for MatrixDecomposed3D

source§

impl ComputeSquaredDistance for Perspective

source§

impl ComputeSquaredDistance for Quaternion

source§

impl ComputeSquaredDistance for Scale2D

source§

impl ComputeSquaredDistance for Scale3D

source§

impl ComputeSquaredDistance for Skew

source§

impl ComputeSquaredDistance for Translate2D

source§

impl ComputeSquaredDistance for Translate3D

source§

impl ComputeSquaredDistance for Angle

source§

impl ComputeSquaredDistance for Zoom

source§

impl ComputeSquaredDistance for FontSize

source§

impl ComputeSquaredDistance for FontStretch

source§

impl ComputeSquaredDistance for style::values::computed::font::FontStyle

source§

impl ComputeSquaredDistance for FontWeight

source§

impl ComputeSquaredDistance for CSSPixelLength

source§

impl ComputeSquaredDistance for LengthPercentage

source§

impl ComputeSquaredDistance for OffsetRotate

source§

impl ComputeSquaredDistance for Percentage

source§

impl ComputeSquaredDistance for Au

source§

impl ComputeSquaredDistance for Path

source§

impl ComputeSquaredDistance for Ratio<f32>

source§

impl ComputeSquaredDistance for KeywordInfo

source§

impl ComputeSquaredDistance for SVGPathData

source§

impl ComputeSquaredDistance for Color

source§

impl ComputeSquaredDistance for FontVariationSettings

source§

impl ComputeSquaredDistance for Matrix3D

source§

impl ComputeSquaredDistance for Rotate

source§

impl ComputeSquaredDistance for Scale

source§

impl ComputeSquaredDistance for Transform

source§

impl ComputeSquaredDistance for TransformOperation

source§

impl ComputeSquaredDistance for Translate

source§

impl ComputeSquaredDistance for GridTemplateComponent

source§

impl<A, B> ComputeSquaredDistance for Either<A, B>

source§

impl<Angle> ComputeSquaredDistance for style::values::generics::font::FontStyle<Angle>

source§

impl<Angle, LengthPercentage> ComputeSquaredDistance for GenericPathOrShapeFunction<Angle, LengthPercentage>
where Angle: ComputeSquaredDistance, LengthPercentage: ComputeSquaredDistance,

source§

impl<Angle, LengthPercentage> ComputeSquaredDistance for GenericShapeCommand<Angle, LengthPercentage>
where Angle: ComputeSquaredDistance, LengthPercentage: ComputeSquaredDistance,

source§

impl<Angle, LengthPercentage> ComputeSquaredDistance for Shape<Angle, LengthPercentage>
where Angle: ComputeSquaredDistance, LengthPercentage: ComputeSquaredDistance,

source§

impl<Angle, NonNegativeFactor, ZeroToOneFactor, Length, Shadow, U> ComputeSquaredDistance for GenericFilter<Angle, NonNegativeFactor, ZeroToOneFactor, Length, Shadow, U>
where Angle: ComputeSquaredDistance, NonNegativeFactor: ComputeSquaredDistance, ZeroToOneFactor: ComputeSquaredDistance, Length: ComputeSquaredDistance, Shadow: ComputeSquaredDistance,

source§

impl<Angle, Position> ComputeSquaredDistance for GenericRayFunction<Angle, Position>

source§

impl<Angle, Position, LengthPercentage, NonNegativeLengthPercentage, BasicShapeRect> ComputeSquaredDistance for GenericBasicShape<Angle, Position, LengthPercentage, NonNegativeLengthPercentage, BasicShapeRect>
where Angle: ComputeSquaredDistance, Position: ComputeSquaredDistance, LengthPercentage: ComputeSquaredDistance, NonNegativeLengthPercentage: ComputeSquaredDistance, BasicShapeRect: ComputeSquaredDistance,

source§

impl<BasicShape, I> ComputeSquaredDistance for GenericShapeOutside<BasicShape, I>
where BasicShape: ComputeSquaredDistance,

source§

impl<BasicShape, U> ComputeSquaredDistance for GenericClipPath<BasicShape, U>
where BasicShape: ComputeSquaredDistance,

source§

impl<C> ComputeSquaredDistance for GenericColorOrAuto<C>

source§

impl<C> ComputeSquaredDistance for GenericSVGPaintFallback<C>

source§

impl<C> ComputeSquaredDistance for GenericCaretColor<C>

source§

impl<C, U> ComputeSquaredDistance for GenericSVGPaintKind<C, U>

source§

impl<Color> ComputeSquaredDistance for GenericScrollbarColor<Color>

source§

impl<Color, SizeLength, BlurShapeLength, ShapeLength> ComputeSquaredDistance for GenericBoxShadow<Color, SizeLength, BlurShapeLength, ShapeLength>
where Color: ComputeSquaredDistance, SizeLength: ComputeSquaredDistance, BlurShapeLength: ComputeSquaredDistance, ShapeLength: ComputeSquaredDistance,

source§

impl<Color, SizeLength, ShapeLength> ComputeSquaredDistance for GenericSimpleShadow<Color, SizeLength, ShapeLength>

source§

impl<Color, Url> ComputeSquaredDistance for GenericSVGPaint<Color, Url>

source§

impl<Factor> ComputeSquaredDistance for GenericFontSizeAdjust<Factor>
where Factor: ComputeSquaredDistance,

source§

impl<Function> ComputeSquaredDistance for GenericOffsetPath<Function>
where Function: ComputeSquaredDistance,

source§

impl<H, V> ComputeSquaredDistance for GenericOffsetPosition<H, V>

source§

impl<H, V> ComputeSquaredDistance for GenericPosition<H, V>

source§

impl<H, V, Depth> ComputeSquaredDistance for GenericTransformOrigin<H, V, Depth>

source§

impl<I> ComputeSquaredDistance for GenericZIndex<I>

source§

impl<I> ComputeSquaredDistance for GenericLineClamp<I>

source§

impl<L> ComputeSquaredDistance for GenericContainIntrinsicSize<L>

source§

impl<L> ComputeSquaredDistance for GenericSVGLength<L>

source§

impl<L> ComputeSquaredDistance for SVGStrokeDashArray<L>

source§

impl<L> ComputeSquaredDistance for GenericTextDecorationLength<L>

source§

impl<L> ComputeSquaredDistance for GenericLetterSpacing<L>

source§

impl<L> ComputeSquaredDistance for Polygon<L>

source§

impl<L> ComputeSquaredDistance for GenericBorderCornerRadius<L>

source§

impl<L> ComputeSquaredDistance for GenericBorderSpacing<L>

source§

impl<L> ComputeSquaredDistance for style::values::generics::size::Size2D<L>

source§

impl<L, N> ComputeSquaredDistance for GenericLengthOrNumber<L, N>

source§

impl<LP> ComputeSquaredDistance for GenericMargin<LP>

source§

impl<LP, N> ComputeSquaredDistance for GenericBorderImageSideWidth<LP, N>

source§

impl<LengthOrAuto> ComputeSquaredDistance for GenericClipRect<LengthOrAuto>
where LengthOrAuto: ComputeSquaredDistance,

source§

impl<LengthPercent> ComputeSquaredDistance for GenericBackgroundSize<LengthPercent>
where LengthPercent: ComputeSquaredDistance,

source§

impl<LengthPercent> ComputeSquaredDistance for GenericLengthPercentageOrAuto<LengthPercent>
where LengthPercent: ComputeSquaredDistance,

source§

impl<LengthPercent> ComputeSquaredDistance for GenericLengthPercentageOrNormal<LengthPercent>
where LengthPercent: ComputeSquaredDistance,

source§

impl<LengthPercent> ComputeSquaredDistance for GenericMaxSize<LengthPercent>

source§

impl<LengthPercent> ComputeSquaredDistance for GenericSize<LengthPercent>

source§

impl<LengthPercentage> ComputeSquaredDistance for GenericVerticalAlign<LengthPercentage>
where LengthPercentage: ComputeSquaredDistance,

source§

impl<LengthPercentage> ComputeSquaredDistance for CoordinatePair<LengthPercentage>
where LengthPercentage: ComputeSquaredDistance,

source§

impl<LengthPercentage> ComputeSquaredDistance for PolygonCoord<LengthPercentage>
where LengthPercentage: ComputeSquaredDistance,

source§

impl<LengthPercentage> ComputeSquaredDistance for GenericBorderRadius<LengthPercentage>
where LengthPercentage: ComputeSquaredDistance,

source§

impl<LengthPercentage> ComputeSquaredDistance for GenericAnchorSizeFunction<LengthPercentage>
where LengthPercentage: ComputeSquaredDistance,

source§

impl<LengthPercentage> ComputeSquaredDistance for GenericTextIndent<LengthPercentage>
where LengthPercentage: ComputeSquaredDistance,

source§

impl<LengthPercentage, NonNegativeLengthPercentage> ComputeSquaredDistance for GenericInsetRect<LengthPercentage, NonNegativeLengthPercentage>
where LengthPercentage: ComputeSquaredDistance, NonNegativeLengthPercentage: ComputeSquaredDistance,

source§

impl<N> ComputeSquaredDistance for PreferredRatio<N>

source§

impl<N> ComputeSquaredDistance for GenericAspectRatio<N>

source§

impl<N, L> ComputeSquaredDistance for GenericLineHeight<N, L>

source§

impl<NonNegativeLength> ComputeSquaredDistance for GenericPerspective<NonNegativeLength>
where NonNegativeLength: ComputeSquaredDistance,

source§

impl<NonNegativeLengthPercentage> ComputeSquaredDistance for GenericShapeRadius<NonNegativeLengthPercentage>
where NonNegativeLengthPercentage: ComputeSquaredDistance,

source§

impl<Number> ComputeSquaredDistance for VariationValue<Number>
where Number: ComputeSquaredDistance,

source§

impl<NumberOrPercentage> ComputeSquaredDistance for GenericBorderImageSlice<NumberOrPercentage>
where NumberOrPercentage: ComputeSquaredDistance,

source§

impl<OpacityType> ComputeSquaredDistance for GenericSVGOpacity<OpacityType>
where OpacityType: ComputeSquaredDistance,

source§

impl<P> ComputeSquaredDistance for AnchorSide<P>

source§

impl<P, LP> ComputeSquaredDistance for GenericInset<P, LP>

source§

impl<Percentage, LengthPercentage> ComputeSquaredDistance for GenericAnchorFunction<Percentage, LengthPercentage>
where Percentage: ComputeSquaredDistance, LengthPercentage: ComputeSquaredDistance,

source§

impl<Pos> ComputeSquaredDistance for GenericPositionOrAuto<Pos>

source§

impl<Position, NonNegativeLengthPercentage> ComputeSquaredDistance for Circle<Position, NonNegativeLengthPercentage>
where Position: ComputeSquaredDistance, NonNegativeLengthPercentage: ComputeSquaredDistance,

source§

impl<Position, NonNegativeLengthPercentage> ComputeSquaredDistance for Ellipse<Position, NonNegativeLengthPercentage>
where Position: ComputeSquaredDistance, NonNegativeLengthPercentage: ComputeSquaredDistance,

source§

impl<PositiveInteger> ComputeSquaredDistance for GenericColumnCount<PositiveInteger>
where PositiveInteger: ComputeSquaredDistance,

source§

impl<R> ComputeSquaredDistance for GenericClipRectOrAuto<R>

source§

impl<S> ComputeSquaredDistance for GenericFlexBasis<S>

source§

impl<Shapes, RayFunction, U> ComputeSquaredDistance for GenericOffsetPathFunction<Shapes, RayFunction, U>
where Shapes: ComputeSquaredDistance, RayFunction: ComputeSquaredDistance,

source§

impl<T> ComputeSquaredDistance for Optional<T>

source§

impl<T> ComputeSquaredDistance for Rect<T>

source§

impl<T> ComputeSquaredDistance for GreaterThanOrEqualToOne<T>

source§

impl<T> ComputeSquaredDistance for NonNegative<T>

source§

impl<T> ComputeSquaredDistance for ZeroToOne<T>

source§

impl<T, const FRACTION_BITS: u16> ComputeSquaredDistance for FixedPoint<T, FRACTION_BITS>

source§

impl<U> ComputeSquaredDistance for GenericUrlOrNone<U>