Skip to main content

ExpressionVariant

Enum ExpressionVariant 

Source
pub enum ExpressionVariant {
Show 16 variants Invalid, Boolean(bool), Double(f64), Vector2(Vector2), Vector3(Vector3), Vector4(Vector4), Vector(Vector), Vector3D(Vector3D), FerroMatrix(Matrix), Matrix3x2(Matrix3x2), Matrix4x4(Matrix4x4), Quaternion(Quaternion), Color(Color), RelativePoint(RelativePoint), RelativeScalar(RelativeScalar), RelativeUnit(RelativeUnit),
}
Expand description

A VARIANT type used in expression animations. Can represent multiple value types.

Every operation that is not defined for its operand types gives ExpressionVariant::Invalid rather than failing.

Variants§

§

Invalid

§

Boolean(bool)

§

Double(f64)

§

Vector2(Vector2)

§

Vector3(Vector3)

§

Vector4(Vector4)

§

Vector(Vector)

§

Vector3D(Vector3D)

§

FerroMatrix(Matrix)

§

Matrix3x2(Matrix3x2)

§

Matrix4x4(Matrix4x4)

§

Quaternion(Quaternion)

§

Color(Color)

§

RelativePoint(RelativePoint)

§

RelativeScalar(RelativeScalar)

§

RelativeUnit(RelativeUnit)

Implementations§

Source§

impl ExpressionVariant

Source

pub fn variant_type(&self) -> VariantType

The type of the held value.

Source

pub fn get_property(&self, property: &str) -> ExpressionVariant

Gets a member (a component or a swizzle) of the held value. Member names are case-sensitive; an unknown member gives Invalid.

Source

pub fn equals_to(&self, right: ExpressionVariant) -> ExpressionVariant

The == operator of expressions: a Boolean for two values of the same comparable type, Invalid otherwise.

Source

pub fn not_equals_to(&self, right: ExpressionVariant) -> ExpressionVariant

The != operator of expressions.

Source

pub fn less_than(&self, right: ExpressionVariant) -> ExpressionVariant

The < operator of expressions.

Source

pub fn more_than(&self, right: ExpressionVariant) -> ExpressionVariant

The > operator of expressions.

Source

pub fn and(&self, right: ExpressionVariant) -> ExpressionVariant

The && operator of expressions.

Source

pub fn or(&self, right: ExpressionVariant) -> ExpressionVariant

The || operator of expressions.

Source

pub fn try_cast<T: ExpressionVariantValue>(&self) -> Option<T>

Converts the held value to T, or None when the variant does not hold a value convertible to T.

Source

pub fn create<T: ExpressionVariantValue>(v: T) -> ExpressionVariant

Creates a variant from a value.

Source

pub fn cast_or_default<T: ExpressionVariantValue>(&self) -> T

Converts the held value to T, or gives the default value of T.

Trait Implementations§

Source§

impl Add for ExpressionVariant

Source§

type Output = ExpressionVariant

The resulting type after applying the + operator.
Source§

fn add(self, right: ExpressionVariant) -> ExpressionVariant

Performs the + operation. Read more
Source§

impl Clone for ExpressionVariant

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for ExpressionVariant

Source§

impl Debug for ExpressionVariant

Source§

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

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

impl Default for ExpressionVariant

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for ExpressionVariant

Source§

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

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

impl Div for ExpressionVariant

Source§

type Output = ExpressionVariant

The resulting type after applying the / operator.
Source§

fn div(self, right: ExpressionVariant) -> ExpressionVariant

Performs the / operation. Read more
Source§

impl From<Color> for ExpressionVariant

Source§

fn from(value: Color) -> ExpressionVariant

Converts to this type from the input type.
Source§

impl From<ExpressionVariant> for PropertySetSnapshotValue

Source§

fn from(v: ExpressionVariant) -> Self

Converts to this type from the input type.
Source§

impl From<Matrix3x2> for ExpressionVariant

Source§

fn from(value: Matrix3x2) -> ExpressionVariant

Converts to this type from the input type.
Source§

impl From<Matrix4x4> for ExpressionVariant

Source§

fn from(value: Matrix4x4) -> ExpressionVariant

Converts to this type from the input type.
Source§

impl From<Matrix> for ExpressionVariant

Source§

fn from(value: Matrix) -> ExpressionVariant

Converts to this type from the input type.
Source§

impl From<Quaternion> for ExpressionVariant

Source§

fn from(value: Quaternion) -> ExpressionVariant

Converts to this type from the input type.
Source§

impl From<RelativePoint> for ExpressionVariant

Source§

fn from(value: RelativePoint) -> ExpressionVariant

Converts to this type from the input type.
Source§

impl From<RelativeScalar> for ExpressionVariant

Source§

fn from(value: RelativeScalar) -> ExpressionVariant

Converts to this type from the input type.
Source§

impl From<RelativeUnit> for ExpressionVariant

Source§

fn from(value: RelativeUnit) -> ExpressionVariant

Converts to this type from the input type.
Source§

impl From<Vector2> for ExpressionVariant

Source§

fn from(value: Vector2) -> ExpressionVariant

Converts to this type from the input type.
Source§

impl From<Vector3> for ExpressionVariant

Source§

fn from(value: Vector3) -> ExpressionVariant

Converts to this type from the input type.
Source§

impl From<Vector3D> for ExpressionVariant

Source§

fn from(value: Vector3D) -> ExpressionVariant

Converts to this type from the input type.
Source§

impl From<Vector4> for ExpressionVariant

Source§

fn from(value: Vector4) -> ExpressionVariant

Converts to this type from the input type.
Source§

impl From<Vector> for ExpressionVariant

Source§

fn from(value: Vector) -> ExpressionVariant

Converts to this type from the input type.
Source§

impl From<bool> for ExpressionVariant

Source§

fn from(value: bool) -> ExpressionVariant

Converts to this type from the input type.
Source§

impl From<f32> for ExpressionVariant

A single-precision scalar is stored as a Double.

Source§

fn from(value: f32) -> ExpressionVariant

Converts to this type from the input type.
Source§

impl From<f64> for ExpressionVariant

Source§

fn from(value: f64) -> ExpressionVariant

Converts to this type from the input type.
Source§

impl Mul for ExpressionVariant

Source§

type Output = ExpressionVariant

The resulting type after applying the * operator.
Source§

fn mul(self, right: ExpressionVariant) -> ExpressionVariant

Performs the * operation. Read more
Source§

impl Neg for ExpressionVariant

Source§

type Output = ExpressionVariant

The resulting type after applying the - operator.
Source§

fn neg(self) -> ExpressionVariant

Performs the unary - operation. Read more
Source§

impl Not for ExpressionVariant

Source§

type Output = ExpressionVariant

The resulting type after applying the ! operator.
Source§

fn not(self) -> ExpressionVariant

Performs the unary ! operation. Read more
Source§

impl PartialEq for ExpressionVariant

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Rem for ExpressionVariant

Source§

type Output = ExpressionVariant

The resulting type after applying the % operator.
Source§

fn rem(self, right: ExpressionVariant) -> ExpressionVariant

Performs the % operation. Read more
Source§

impl StructuralPartialEq for ExpressionVariant

Source§

impl Sub for ExpressionVariant

Source§

type Output = ExpressionVariant

The resulting type after applying the - operator.
Source§

fn sub(self, right: ExpressionVariant) -> ExpressionVariant

Performs the - operation. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AnyValue for T
where T: PartialEq + 'static,

Source§

fn any_value_as_any(&self) -> &(dyn Any + 'static)

Source§

fn any_value_eq(&self, other: &(dyn AnyValue + 'static)) -> bool

Source§

fn any_value_type_name(&self) -> &'static str

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> ClassDefaults for T
where T: ?Sized,

Source§

fn static_constructor()

The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides). Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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, Rhs, Output> NumOps<Rhs, Output> for T
where T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,

Source§

impl<T> PropertyValue for T
where T: Clone + PartialEq + 'static,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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.