# Enum style::values::generics::transform::GenericTransformOperation

``````#[repr(C, u8)]pub enum GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>where
Angle: Zero,
LengthPercentage: Zero + ZeroNoPercent,
Number: PartialEq,{
Show 23 variants    Matrix(GenericMatrix<Number>),
Matrix3D(GenericMatrix3D<Number>),
Skew(Angle, Angle),
SkewX(Angle),
SkewY(Angle),
Translate(LengthPercentage, LengthPercentage),
TranslateX(LengthPercentage),
TranslateY(LengthPercentage),
TranslateZ(Length),
Translate3D(LengthPercentage, LengthPercentage, Length),
Scale(Number, Number),
ScaleX(Number),
ScaleY(Number),
ScaleZ(Number),
Scale3D(Number, Number, Number),
Rotate(Angle),
RotateX(Angle),
RotateY(Angle),
RotateZ(Angle),
Rotate3D(Number, Number, Number, Angle),
Perspective(GenericPerspectiveFunction<Length>),
InterpolateMatrix {
from_list: GenericTransform<GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>>,
to_list: GenericTransform<GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>>,
progress: Percentage,
},
AccumulateMatrix {
from_list: GenericTransform<GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>>,
to_list: GenericTransform<GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>>,
count: Integer,
},
}``````
Expand description

A single operation in the list of a `transform` value

## Variants§

§

### Matrix(GenericMatrix<Number>)

Represents a 2D 2x3 matrix.

§

### Matrix3D(GenericMatrix3D<Number>)

Represents a 3D 4x4 matrix.

§

### Skew(Angle, Angle)

A 2D skew.

If the second angle is not provided it is assumed zero.

Syntax can be skew(angle) or skew(angle, angle)

§

skewX(angle)

§

skewY(angle)

§

### Translate(LengthPercentage, LengthPercentage)

translate(x, y) or translate(x)

§

translateX(x)

§

translateY(y)

§

translateZ(z)

§

### Translate3D(LengthPercentage, LengthPercentage, Length)

translate3d(x, y, z)

§

### Scale(Number, Number)

A 2D scaling factor.

Syntax can be scale(factor) or scale(factor, factor)

§

scaleX(factor)

§

scaleY(factor)

§

scaleZ(factor)

§

### Scale3D(Number, Number, Number)

scale3D(factorX, factorY, factorZ)

§

### Rotate(Angle)

Describes a 2D Rotation.

In a 3D scene `rotate(angle)` is equivalent to `rotateZ(angle)`.

§

### RotateX(Angle)

Rotation in 3D space around the x-axis.

§

### RotateY(Angle)

Rotation in 3D space around the y-axis.

§

### RotateZ(Angle)

Rotation in 3D space around the z-axis.

§

### Rotate3D(Number, Number, Number, Angle)

Rotation in 3D space.

Generalization of rotateX, rotateY and rotateZ.

§

### Perspective(GenericPerspectiveFunction<Length>)

Specifies a perspective projection matrix.

Part of CSS Transform Module Level 2 and defined at § 13.1. 3D Transform Function.

The value must be greater than or equal to zero.

§

### InterpolateMatrix

#### Fields

§`from_list: GenericTransform<GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>>`
§`to_list: GenericTransform<GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>>`
§`progress: Percentage`

A intermediate type for interpolation of mismatched transform lists.

§

### AccumulateMatrix

#### Fields

§`from_list: GenericTransform<GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>>`
§`to_list: GenericTransform<GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>>`
§`count: Integer`

A intermediate type for accumulation of mismatched transform lists.

## Implementations§

source§

### impl GenericTransformOperation<Angle, f32, CSSPixelLength, i32, LengthPercentage>

source

#### fn try_animate_mismatched_transforms_in_place( left: &[Self], right: &[Self], procedure: Procedure ) -> Result<Self, ()>

If there are no size dependencies, we try to animate in-place, to avoid creating deeply nested Interpolate* operations.

source

source§

### impl GenericTransformOperation<Angle, f32, CSSPixelLength, i32, LengthPercentage>

source

#### pub fn to_translate_3d(&self) -> Self

Convert to a Translate3D.

Must be called on a Translate function

source

#### pub fn to_rotate_3d(&self) -> Self

Convert to a Rotate3D.

Must be called on a Rotate function.

source

#### pub fn to_scale_3d(&self) -> Self

Convert to a Scale3D.

Must be called on a Scale function

source§

### impl<Angle, Number, Length, Integer, LengthPercentage> TransformOperation<Angle, Number, Length, Integer, LengthPercentage>where Angle: Zero, LengthPercentage: Zero + ZeroNoPercent, Number: PartialEq,

source

#### pub fn is_rotate(&self) -> bool

Check if it is any rotate function.

source

#### pub fn is_translate(&self) -> bool

Check if it is any translate function

source

#### pub fn is_scale(&self) -> bool

Check if it is any scale function

## Trait Implementations§

source§

### impl<Angle, Number, Length: Clone, Integer: Clone, LengthPercentage> Clone for GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>where Angle: Zero + Clone, LengthPercentage: Zero + ZeroNoPercent + Clone, Number: PartialEq + Clone,

source§

#### fn clone( &self ) -> GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>

Returns a copy of the value. Read more
1.0.0 · source§

#### fn clone_from(&mut self, source: &Self)

Performs copy-assignment from `source`. Read more
source§

### impl<Angle, Number, Length: Debug, Integer: Debug, LengthPercentage> Debug for GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>where Angle: Zero + Debug, LengthPercentage: Zero + ZeroNoPercent + Debug, Number: PartialEq + Debug,

source§

#### fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

### impl<'de, Angle, Number, Length, Integer, LengthPercentage> Deserialize<'de> for GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>where Angle: Zero + Deserialize<'de>, LengthPercentage: Zero + ZeroNoPercent + Deserialize<'de>, Number: PartialEq + Deserialize<'de>, Length: Deserialize<'de>, Integer: Deserialize<'de>,

source§

#### fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

### impl<Angle, Number, Length, Integer, LengthPercentage> MallocSizeOf for GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>where Angle: Zero + MallocSizeOf, LengthPercentage: Zero + ZeroNoPercent + MallocSizeOf, Number: PartialEq + MallocSizeOf, Length: MallocSizeOf, Integer: MallocSizeOf,

source§

#### fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize

Measure the heap usage of all descendant heap-allocated structures, but not the space taken up by the value itself.
source§

### impl<Angle, Number, Length: PartialEq, Integer: PartialEq, LengthPercentage> PartialEq for GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>where Angle: Zero + PartialEq, LengthPercentage: Zero + ZeroNoPercent + PartialEq, Number: PartialEq + PartialEq,

source§

#### fn eq( &self, other: &GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage> ) -> bool

This method tests for `self` and `other` values to be equal, and is used by `==`.
1.0.0 · source§

#### fn ne(&self, other: &Rhs) -> bool

This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

### impl<Angle, Number, Length, Integer, LengthPercentage> Serialize for GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>where Angle: Zero + Serialize, LengthPercentage: Zero + ZeroNoPercent + Serialize, Number: PartialEq + Serialize, Length: Serialize, Integer: Serialize,

source§

#### fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

### impl<Angle, Number, Length, Integer, LengthPercentage> SpecifiedValueInfo for GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>where Angle: Zero + SpecifiedValueInfo, LengthPercentage: Zero + ZeroNoPercent + SpecifiedValueInfo, Number: PartialEq + SpecifiedValueInfo, Length: SpecifiedValueInfo, Integer: SpecifiedValueInfo,

source§

#### const SUPPORTED_TYPES: u8 = 0u8

Supported CssTypes by the given value type. Read more
source§

#### fn collect_completion_keywords(_f: &mut dyn FnMut(&[&'static str]))

Collect value starting words for the given specified value type. This includes keyword and function names which can appear at the beginning of a value of this type. Read more
source§

### impl<Angle, Number, Length, Integer, LengthPercentage> ToComputedValue for GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>where Angle: Zero + ToComputedValue, LengthPercentage: Zero + ZeroNoPercent + ToComputedValue, Number: PartialEq + ToComputedValue, <Angle as ToComputedValue>::ComputedValue: Zero, <LengthPercentage as ToComputedValue>::ComputedValue: Zero + ZeroNoPercent, <Number as ToComputedValue>::ComputedValue: PartialEq, Length: ToComputedValue, Integer: ToComputedValue,

§

#### type ComputedValue = GenericTransformOperation<<Angle as ToComputedValue>::ComputedValue, <Number as ToComputedValue>::ComputedValue, <Length as ToComputedValue>::ComputedValue, <Integer as ToComputedValue>::ComputedValue, <LengthPercentage as ToComputedValue>::ComputedValue>

The computed value type we’re going to be converted to.
source§

#### fn from_computed_value(from: &Self::ComputedValue) -> Self

Convert a computed value to specified value form. Read more
source§

#### fn to_computed_value(&self, context: &Context<'_>) -> Self::ComputedValue

Convert a specified value to a computed value, using itself and the data inside the `Context`.
source§

### impl<Angle, Number, Length, Integer, LengthPercentage> ToCss for GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>where Angle: Zero + ToCss, LengthPercentage: Zero + ZeroNoPercent + ToCss, Number: PartialEq + ToCss, Length: ToCss, Integer: ToCss,

source§

#### fn to_css<W>(&self, dest: &mut CssWriter<'_, W>) -> Resultwhere W: Write,

Serialize `self` in CSS syntax, writing to `dest`.
source§

#### fn to_css_string(&self) -> String

Serialize `self` in CSS syntax and return a string. Read more
source§

### impl<Angle, Number, Length, Integer, LoP> ToMatrix for TransformOperation<Angle, Number, Length, Integer, LoP>where Angle: Zero + ToRadians + Copy, Number: PartialEq + Copy + Into<f32> + Into<f64>, Length: ToAbsoluteLength, LoP: Zero + ToAbsoluteLength + ZeroNoPercent,

source§

#### fn to_3d_matrix( &self, reference_box: Option<&Rect<ComputedLength>> ) -> Result<Transform3D<f64>, ()>

If |reference_box| is None, we will drop the percent part from translate because we cannot resolve it without the layout info, for computed TransformOperation. However, for specified TransformOperation, we will return Err(()) if there is any relative lengths because the only caller, DOMMatrix, doesn’t accept relative lengths.

source§

#### fn is_3d(&self) -> bool

Check if it is a 3d transform function.
source§

### impl<Angle, Number, Length, Integer, LengthPercentage> ToResolvedValue for GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>where Angle: Zero + ToResolvedValue, LengthPercentage: Zero + ZeroNoPercent + ToResolvedValue, Number: PartialEq + ToResolvedValue, <Angle as ToResolvedValue>::ResolvedValue: Zero, <LengthPercentage as ToResolvedValue>::ResolvedValue: Zero + ZeroNoPercent, <Number as ToResolvedValue>::ResolvedValue: PartialEq, Length: ToResolvedValue, Integer: ToResolvedValue,

§

#### type ResolvedValue = GenericTransformOperation<<Angle as ToResolvedValue>::ResolvedValue, <Number as ToResolvedValue>::ResolvedValue, <Length as ToResolvedValue>::ResolvedValue, <Integer as ToResolvedValue>::ResolvedValue, <LengthPercentage as ToResolvedValue>::ResolvedValue>

The resolved value type we’re going to be converted to.
source§

#### fn from_resolved_value(from: Self::ResolvedValue) -> Self

Convert a resolved value to resolved value form.
source§

#### fn to_resolved_value(self, context: &Context<'_>) -> Self::ResolvedValue

Convert a resolved value to a resolved value.
source§

### impl<Angle, Number, Length, Integer, LengthPercentage> ToShmem for GenericTransformOperation<Angle, Number, Length, Integer, LengthPercentage>where Angle: Zero + ToShmem, LengthPercentage: Zero + ZeroNoPercent + ToShmem, Number: PartialEq + ToShmem, Length: ToShmem, Integer: ToShmem,

source§

#### fn to_shmem(&self, builder: &mut SharedMemoryBuilder) -> Result<Self>

Clones this value into a form suitable for writing into a SharedMemoryBuilder. Read more
source§

§

§

§

§

§

§

## Blanket Implementations§

source§

### impl<T> Any for Twhere T: 'static + ?Sized,

source§

#### fn type_id(&self) -> TypeId

Gets the `TypeId` of `self`. Read more
source§

### impl<T> Borrow<T> for Twhere T: ?Sized,

source§

#### fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

### impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

#### fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

### impl<T> From<T> for T

source§

#### fn from(t: T) -> T

Returns the argument unchanged.

source§

### impl<T, U> Into<U> for Twhere U: From<T>,

source§

#### fn into(self) -> U

Calls `U::from(self)`.

That is, this conversion is whatever the implementation of `From<T> for U` chooses to do.

source§

### impl<T> IntoEither for T

source§

#### fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts `self` into a `Left` variant of `Either<Self, Self>` if `into_left` is `true`. Converts `self` into a `Right` variant of `Either<Self, Self>` otherwise. Read more
source§

#### fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>where F: FnOnce(&Self) -> bool,

Converts `self` into a `Left` variant of `Either<Self, Self>` if `into_left(&self)` returns `true`. Converts `self` into a `Right` variant of `Either<Self, Self>` otherwise. Read more
source§

source§

Convert
source§

source§

Convert
source§

### impl<T> Pointable for T

source§

#### const ALIGN: usize = _

The alignment of pointer.
§

#### type Init = T

The type for initializers.
source§

#### unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

#### unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

#### unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

#### unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

### impl<T> Same for T

§

#### type Output = T

Should always be `Self`
source§

### impl<T> ToOwned for Twhere T: Clone,

§

#### type Owned = T

The resulting type after obtaining ownership.
source§

#### fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

#### fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

### impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

#### type Error = Infallible

The type returned in the event of a conversion error.
source§

#### fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

### impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

#### type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

#### fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

source§

source§