Skip to main content

Mat2

Struct Mat2 

Source
pub struct Mat2(/* private fields */);
Expand description

A 2x2 column major matrix.

SIMD vector types are used for storage on supported platforms.

This type is 16 byte aligned.

Implementations§

Source§

impl Mat2

Source

pub const ZERO: Mat2

A 2x2 matrix with all elements set to 0.0.

Source

pub const IDENTITY: Mat2

A 2x2 identity matrix, where all diagonal elements are 1, and all off-diagonal elements are 0.

Source

pub const NAN: Mat2

All NAN:s.

Source

pub const fn from_cols(x_axis: Vec2, y_axis: Vec2) -> Mat2

Creates a 2x2 matrix from two column vectors.

Source

pub const fn from_cols_array(m: &[f32; 4]) -> Mat2

Creates a 2x2 matrix from a [f32; 4] array stored in column major order. If your data is stored in row major you will need to transpose the returned matrix.

Source

pub const fn to_cols_array(&self) -> [f32; 4]

Creates a [f32; 4] array storing data in column major order. If you require data in row major order transpose the matrix first.

Source

pub const fn from_cols_array_2d(m: &[[f32; 2]; 2]) -> Mat2

Creates a 2x2 matrix from a [[f32; 2]; 2] 2D array stored in column major order. If your data is in row major order you will need to transpose the returned matrix.

Source

pub const fn to_cols_array_2d(&self) -> [[f32; 2]; 2]

Creates a [[f32; 2]; 2] 2D array storing data in column major order. If you require data in row major order transpose the matrix first.

Source

pub const fn from_diagonal(diagonal: Vec2) -> Mat2

Creates a 2x2 matrix with its diagonal set to diagonal and all other entries set to 0.

Source

pub fn from_scale_angle(scale: Vec2, angle: f32) -> Mat2

Creates a 2x2 matrix containing the combining non-uniform scale and rotation of angle (in radians).

Source

pub fn from_angle(angle: f32) -> Mat2

Creates a 2x2 matrix containing a rotation of angle (in radians).

Source

pub fn from_mat3(m: Mat3) -> Mat2

Creates a 2x2 matrix from a 3x3 matrix, discarding the 2nd row and column.

Source

pub fn from_mat3_minor(m: Mat3, i: usize, j: usize) -> Mat2

Creates a 2x2 matrix from the minor of the given 3x3 matrix, discarding the ith column and jth row.

§Panics

Panics if i or j is greater than 2.

Source

pub fn from_mat3a(m: Mat3A) -> Mat2

Creates a 2x2 matrix from a 3x3 matrix, discarding the 2nd row and column.

Source

pub fn from_mat3a_minor(m: Mat3A, i: usize, j: usize) -> Mat2

Creates a 2x2 matrix from the minor of the given 3x3 matrix, discarding the ith column and jth row.

§Panics

Panics if i or j is greater than 2.

Source

pub const fn from_cols_slice(slice: &[f32]) -> Mat2

Creates a 2x2 matrix from the first 4 values in slice.

§Panics

Panics if slice is less than 4 elements long.

Source

pub fn write_cols_to_slice(&self, slice: &mut [f32])

Writes the columns of self to the first 4 elements in slice.

§Panics

Panics if slice is less than 4 elements long.

Source

pub fn col(&self, index: usize) -> Vec2

Returns the matrix column for the given index.

§Panics

Panics if index is greater than 1.

Source

pub fn col_mut(&mut self, index: usize) -> &mut Vec2

Returns a mutable reference to the matrix column for the given index.

§Panics

Panics if index is greater than 1.

Source

pub fn row(&self, index: usize) -> Vec2

Returns the matrix row for the given index.

§Panics

Panics if index is greater than 1.

Source

pub fn is_finite(&self) -> bool

Returns true if, and only if, all elements are finite. If any element is either NaN, positive or negative infinity, this will return false.

Source

pub fn is_nan(&self) -> bool

Returns true if any elements are NaN.

Source

pub fn transpose(&self) -> Mat2

Returns the transpose of self.

Source

pub fn diagonal(&self) -> Vec2

Returns the diagonal of self.

Source

pub fn determinant(&self) -> f32

Returns the determinant of self.

Source

pub fn inverse(&self) -> Mat2

Returns the inverse of self.

If the matrix is not invertible the returned matrix will be invalid.

§Panics

Will panic if the determinant of self is zero when glam_assert is enabled.

Source

pub fn try_inverse(&self) -> Option<Mat2>

Returns the inverse of self or None if the matrix is not invertible.

Source

pub fn inverse_or_zero(&self) -> Mat2

Returns the inverse of self or Mat2::ZERO if the matrix is not invertible.

Source

pub fn mul_vec2(&self, rhs: Vec2) -> Vec2

Transforms a 2D vector.

Source

pub fn mul_transpose_vec2(&self, rhs: Vec2) -> Vec2

Transforms a 2D vector by the transpose of self.

Source

pub fn mul_mat2(&self, rhs: &Mat2) -> Mat2

Multiplies two 2x2 matrices.

Source

pub fn add_mat2(&self, rhs: &Mat2) -> Mat2

Adds two 2x2 matrices.

Source

pub fn sub_mat2(&self, rhs: &Mat2) -> Mat2

Subtracts two 2x2 matrices.

Source

pub fn mul_scalar(&self, rhs: f32) -> Mat2

Multiplies a 2x2 matrix by a scalar.

Source

pub fn mul_diagonal_scale(&self, scale: Vec2) -> Mat2

Multiply self by a scaling vector scale. This is faster than creating a whole diagonal scaling matrix and then multiplying that. This operation is commutative.

Source

pub fn div_scalar(&self, rhs: f32) -> Mat2

Divides a 2x2 matrix by a scalar.

Source

pub fn recip(&self) -> Mat2

Returns a matrix containing the reciprocal 1.0/n of each element of self.

Source

pub fn abs_diff_eq(&self, rhs: Mat2, max_abs_diff: f32) -> bool

Returns true if the absolute difference of all elements between self and rhs is less than or equal to max_abs_diff.

This can be used to compare if two matrices contain similar elements. It works best when comparing with a known value. The max_abs_diff that should be used used depends on the values being compared against.

For more see comparing floating point numbers.

Source

pub fn abs(&self) -> Mat2

Takes the absolute value of each element in self

Source

pub fn as_dmat2(&self) -> DMat2

Trait Implementations§

Source§

impl Add<&Mat2> for &Mat2

Source§

type Output = Mat2

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Mat2) -> Mat2

Performs the + operation. Read more
Source§

impl Add<&Mat2> for Mat2

Source§

type Output = Mat2

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Mat2) -> Mat2

Performs the + operation. Read more
Source§

impl Add<Mat2> for &Mat2

Source§

type Output = Mat2

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Mat2) -> Mat2

Performs the + operation. Read more
Source§

impl Add for Mat2

Source§

type Output = Mat2

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Mat2) -> Mat2

Performs the + operation. Read more
Source§

impl AddAssign<&Mat2> for Mat2

Source§

fn add_assign(&mut self, rhs: &Mat2)

Performs the += operation. Read more
Source§

impl AddAssign for Mat2

Source§

fn add_assign(&mut self, rhs: Mat2)

Performs the += operation. Read more
Source§

impl Archive for Mat2

Source§

type Archived = Mat2

The archived representation of this type. Read more
Source§

type Resolver = ()

The resolver for this type. It must contain all the additional information from serializing needed to make the archived type from the normal type.
Source§

fn resolve( &self, _: <Mat2 as Archive>::Resolver, out: Place<<Mat2 as Archive>::Archived>, )

Creates the archived version of this value at the given position and writes it to the given output. Read more
Source§

const COPY_OPTIMIZATION: CopyOptimization<Self> = _

An optimization flag that allows the bytes of this type to be copied directly to a writer instead of calling serialize. Read more
Source§

impl AsMut<[f32; 4]> for Mat2

Source§

fn as_mut(&mut self) -> &mut [f32; 4]

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl AsRef<[f32; 4]> for Mat2

Source§

fn as_ref(&self) -> &[f32; 4]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<C> CheckBytes<C> for Mat2
where C: Fallible + ?Sized,

Source§

unsafe fn check_bytes( _value: *const Mat2, _: &mut C, ) -> Result<(), <C as Fallible>::Error>

Checks whether the given pointer points to a valid value within the given context. Read more
Source§

impl Clone for Mat2

Source§

fn clone(&self) -> Mat2

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 Debug for Mat2

Source§

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

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

impl Default for Mat2

Source§

fn default() -> Mat2

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

impl Deref for Mat2

Source§

type Target = Cols2<Vec2>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &<Mat2 as Deref>::Target

Dereferences the value.
Source§

impl DerefMut for Mat2

Source§

fn deref_mut(&mut self) -> &mut <Mat2 as Deref>::Target

Mutably dereferences the value.
Source§

impl<'de> Deserialize<'de> for Mat2

Deserialize expects a sequence of 4 values.

Source§

fn deserialize<D>( deserializer: D, ) -> Result<Mat2, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

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

impl<D> Deserialize<Mat2, D> for Mat2
where D: Fallible + ?Sized,

Source§

fn deserialize(&self, _: &mut D) -> Result<Mat2, <D as Fallible>::Error>

Deserializes using the given deserializer
Source§

impl Display for Mat2

Source§

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

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

impl Div<&f32> for &Mat2

Source§

type Output = Mat2

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &f32) -> Mat2

Performs the / operation. Read more
Source§

impl Div<&f32> for Mat2

Source§

type Output = Mat2

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &f32) -> Mat2

Performs the / operation. Read more
Source§

impl Div<f32> for &Mat2

Source§

type Output = Mat2

The resulting type after applying the / operator.
Source§

fn div(self, rhs: f32) -> Mat2

Performs the / operation. Read more
Source§

impl Div<f32> for Mat2

Source§

type Output = Mat2

The resulting type after applying the / operator.
Source§

fn div(self, rhs: f32) -> Mat2

Performs the / operation. Read more
Source§

impl DivAssign<&f32> for Mat2

Source§

fn div_assign(&mut self, rhs: &f32)

Performs the /= operation. Read more
Source§

impl DivAssign<f32> for Mat2

Source§

fn div_assign(&mut self, rhs: f32)

Performs the /= operation. Read more
Source§

impl From<ColumnMatrix2<f32>> for Mat2

Source§

fn from(m: ColumnMatrix2<f32>) -> Mat2

Converts to this type from the input type.
Source§

impl From<Rot2> for Mat2

Source§

fn from(rot: Rot2) -> Mat2

Creates a Mat2 rotation matrix from a Rot2.

Source§

impl From<RowMatrix2<f32>> for Mat2

Source§

fn from(m: RowMatrix2<f32>) -> Mat2

Converts to this type from the input type.
Source§

impl IntoMint for Mat2

Source§

type MintType = ColumnMatrix2<f32>

The mint type that this type is associated with.
Source§

impl Mul<&Mat2> for &Mat2

Source§

type Output = Mat2

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Mat2) -> Mat2

Performs the * operation. Read more
Source§

impl Mul<&Mat2> for Mat2

Source§

type Output = Mat2

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Mat2) -> Mat2

Performs the * operation. Read more
Source§

impl Mul<&Vec2> for &Mat2

Source§

type Output = Vec2

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Vec2) -> Vec2

Performs the * operation. Read more
Source§

impl Mul<&Vec2> for Mat2

Source§

type Output = Vec2

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Vec2) -> Vec2

Performs the * operation. Read more
Source§

impl Mul<&f32> for &Mat2

Source§

type Output = Mat2

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &f32) -> Mat2

Performs the * operation. Read more
Source§

impl Mul<&f32> for Mat2

Source§

type Output = Mat2

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &f32) -> Mat2

Performs the * operation. Read more
Source§

impl Mul<Mat2> for &Mat2

Source§

type Output = Mat2

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Mat2) -> Mat2

Performs the * operation. Read more
Source§

impl Mul<Vec2> for &Mat2

Source§

type Output = Vec2

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Vec2) -> Vec2

Performs the * operation. Read more
Source§

impl Mul<Vec2> for Mat2

Source§

type Output = Vec2

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Vec2) -> <Mat2 as Mul<Vec2>>::Output

Performs the * operation. Read more
Source§

impl Mul<f32> for &Mat2

Source§

type Output = Mat2

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: f32) -> Mat2

Performs the * operation. Read more
Source§

impl Mul<f32> for Mat2

Source§

type Output = Mat2

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: f32) -> Mat2

Performs the * operation. Read more
Source§

impl Mul for Mat2

Source§

type Output = Mat2

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Mat2) -> Mat2

Performs the * operation. Read more
Source§

impl MulAssign<&Mat2> for Mat2

Source§

fn mul_assign(&mut self, rhs: &Mat2)

Performs the *= operation. Read more
Source§

impl MulAssign<&f32> for Mat2

Source§

fn mul_assign(&mut self, rhs: &f32)

Performs the *= operation. Read more
Source§

impl MulAssign<f32> for Mat2

Source§

fn mul_assign(&mut self, rhs: f32)

Performs the *= operation. Read more
Source§

impl MulAssign for Mat2

Source§

fn mul_assign(&mut self, rhs: Mat2)

Performs the *= operation. Read more
Source§

impl Neg for &Mat2

Source§

type Output = Mat2

The resulting type after applying the - operator.
Source§

fn neg(self) -> Mat2

Performs the unary - operation. Read more
Source§

impl Neg for Mat2

Source§

type Output = Mat2

The resulting type after applying the - operator.
Source§

fn neg(self) -> <Mat2 as Neg>::Output

Performs the unary - operation. Read more
Source§

impl PartialEq for Mat2

Source§

fn eq(&self, rhs: &Mat2) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> Product<&'a Mat2> for Mat2

Source§

fn product<I>(iter: I) -> Mat2
where I: Iterator<Item = &'a Mat2>,

Takes an iterator and generates Self from the elements by multiplying the items.
Source§

impl Product for Mat2

Source§

fn product<I>(iter: I) -> Mat2
where I: Iterator<Item = Mat2>,

Takes an iterator and generates Self from the elements by multiplying the items.
Source§

impl<S> Serialize<S> for Mat2
where S: Fallible + ?Sized,

Source§

fn serialize( &self, _: &mut S, ) -> Result<<Mat2 as Archive>::Resolver, <S as Fallible>::Error>

Writes the dependencies for the object and returns a resolver that can create the archived type.
Source§

impl Serialize for Mat2

Serialize as a sequence of 4 values.

Source§

fn serialize<S>( &self, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

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

impl Sub<&Mat2> for &Mat2

Source§

type Output = Mat2

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Mat2) -> Mat2

Performs the - operation. Read more
Source§

impl Sub<&Mat2> for Mat2

Source§

type Output = Mat2

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Mat2) -> Mat2

Performs the - operation. Read more
Source§

impl Sub<Mat2> for &Mat2

Source§

type Output = Mat2

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Mat2) -> Mat2

Performs the - operation. Read more
Source§

impl Sub for Mat2

Source§

type Output = Mat2

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Mat2) -> Mat2

Performs the - operation. Read more
Source§

impl SubAssign<&Mat2> for Mat2

Source§

fn sub_assign(&mut self, rhs: &Mat2)

Performs the -= operation. Read more
Source§

impl SubAssign for Mat2

Source§

fn sub_assign(&mut self, rhs: Mat2)

Performs the -= operation. Read more
Source§

impl<'a> Sum<&'a Mat2> for Mat2

Source§

fn sum<I>(iter: I) -> Mat2
where I: Iterator<Item = &'a Mat2>,

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl Sum for Mat2

Source§

fn sum<I>(iter: I) -> Mat2
where I: Iterator<Item = Mat2>,

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl Zeroable for Mat2

Source§

fn zeroed() -> Self

Source§

impl Copy for Mat2

Source§

impl NoUndef for Mat2

Source§

impl Pod for Mat2

Source§

impl Portable for Mat2

Auto Trait Implementations§

§

impl Freeze for Mat2

§

impl RefUnwindSafe for Mat2

§

impl Send for Mat2

§

impl Sync for Mat2

§

impl Unpin for Mat2

§

impl UnsafeUnpin for Mat2

§

impl UnwindSafe for Mat2

Blanket Implementations§

Source§

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
where T: Real + Zero + Arithmetics + Clone, Swp: WhitePoint<T>, Dwp: WhitePoint<T>, D: AdaptFrom<S, Swp, Dwp, T>,

Source§

fn adapt_into_using<M>(self, method: M) -> D
where M: TransformMatrix<T>,

Convert the source color to the destination color using the specified method.
Source§

fn adapt_into(self) -> D

Convert the source color to the destination color using the bradford method by default.
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> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
Source§

impl<T> ArchiveUnsized for T
where T: Archive,

Source§

type Archived = <T as Archive>::Archived

The archived counterpart of this type. Unlike Archive, it may be unsized. Read more
Source§

fn archived_metadata( &self, ) -> <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata

Creates the archived version of the metadata for this value.
Source§

impl<T, C> ArraysFrom<C> for T
where C: IntoArrays<T>,

Source§

fn arrays_from(colors: C) -> T

Cast a collection of colors into a collection of arrays.
Source§

impl<T, C> ArraysInto<C> for T
where C: FromArrays<T>,

Source§

fn arrays_into(self) -> C

Cast this collection of arrays into a collection of colors.
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<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for U
where T: FromCam16Unclamped<WpParam, U>,

Source§

type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar

The number type that’s used in parameters when converting.
Source§

fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T

Converts self into C, using the provided parameters.
Source§

impl<T> CheckedBitPattern for T
where T: AnyBitPattern,

Source§

type Bits = T

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
Source§

fn is_valid_bit_pattern(_bits: &T) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
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, C> ComponentsFrom<C> for T
where C: IntoComponents<T>,

Source§

fn components_from(colors: C) -> T

Cast a collection of colors into a collection of color components.
Source§

impl<T> Content for T
where T: Copy,

Source§

type Owned = T

A type that holds a sized version of the content.
Source§

unsafe fn read<F, E>(size: usize, f: F) -> Result<T, E>
where F: FnOnce(&mut T) -> Result<(), E>,

Prepares an output buffer, then turns this buffer into an Owned. User-provided closure F must only write to and not read from &mut Self.
Source§

fn get_elements_size() -> usize

Returns the size of each element.
Source§

fn to_void_ptr(&self) -> *const ()

Produces a pointer to the data.
Source§

fn ref_from_ptr<'a>(ptr: *mut (), size: usize) -> Option<*mut T>

Builds a pointer to this type from a raw pointer.
Source§

fn is_size_suitable(size: usize) -> bool

Returns true if the size is suitable to store a type like this.
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

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

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

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

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

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

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

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

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSend for T
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromAngle<T> for T

Source§

fn from_angle(angle: T) -> T

Performs a conversion from angle.
Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T, U> FromStimulus<U> for T
where U: IntoStimulus<T>,

Source§

fn from_stimulus(other: U) -> T

Converts other into Self, while performing the appropriate scaling, rounding and clamping.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, U> IntoAngle<U> for T
where U: FromAngle<T>,

Source§

fn into_angle(self) -> U

Performs a conversion into T.
Source§

impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for U
where T: Cam16FromUnclamped<WpParam, U>,

Source§

type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar

The number type that’s used in parameters when converting.
Source§

fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T

Converts self into C, using the provided parameters.
Source§

impl<T, U> IntoColor<U> for T
where U: FromColor<T>,

Source§

fn into_color(self) -> U

Convert into T with values clamped to the color defined bounds Read more
Source§

impl<T, U> IntoColorUnclamped<U> for T
where U: FromColorUnclamped<T>,

Source§

fn into_color_unclamped(self) -> U

Convert into T. The resulting color might be invalid in its color space Read more
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§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> IntoStimulus<T> for T

Source§

fn into_stimulus(self) -> T

Converts self into T, while performing the appropriate scaling, rounding and clamping.
Source§

impl<T> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
Source§

impl<T> Lerpable for T
where T: Sub<Output = T> + Add<Output = T> + Mul<f32, Output = T> + Copy,

Source§

fn lerp(self, other: Self, progress: f32) -> Self

Source§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

Source§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
Source§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
Source§

impl<D> OwoColorize for D

Source§

fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>
where C: Color,

Set the foreground color generically Read more
Source§

fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>
where C: Color,

Set the background color generically. Read more
Source§

fn black(&self) -> FgColorDisplay<'_, Black, Self>

Change the foreground color to black
Source§

fn on_black(&self) -> BgColorDisplay<'_, Black, Self>

Change the background color to black
Source§

fn red(&self) -> FgColorDisplay<'_, Red, Self>

Change the foreground color to red
Source§

fn on_red(&self) -> BgColorDisplay<'_, Red, Self>

Change the background color to red
Source§

fn green(&self) -> FgColorDisplay<'_, Green, Self>

Change the foreground color to green
Source§

fn on_green(&self) -> BgColorDisplay<'_, Green, Self>

Change the background color to green
Source§

fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>

Change the foreground color to yellow
Source§

fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>

Change the background color to yellow
Source§

fn blue(&self) -> FgColorDisplay<'_, Blue, Self>

Change the foreground color to blue
Source§

fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>

Change the background color to blue
Source§

fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to magenta
Source§

fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to magenta
Source§

fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to purple
Source§

fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to purple
Source§

fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>

Change the foreground color to cyan
Source§

fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>

Change the background color to cyan
Source§

fn white(&self) -> FgColorDisplay<'_, White, Self>

Change the foreground color to white
Source§

fn on_white(&self) -> BgColorDisplay<'_, White, Self>

Change the background color to white
Source§

fn default_color(&self) -> FgColorDisplay<'_, Default, Self>

Change the foreground color to the terminal default
Source§

fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>

Change the background color to the terminal default
Source§

fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>

Change the foreground color to bright black
Source§

fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>

Change the background color to bright black
Source§

fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>

Change the foreground color to bright red
Source§

fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>

Change the background color to bright red
Source§

fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>

Change the foreground color to bright green
Source§

fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>

Change the background color to bright green
Source§

fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>

Change the foreground color to bright yellow
Source§

fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>

Change the background color to bright yellow
Source§

fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>

Change the foreground color to bright blue
Source§

fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>

Change the background color to bright blue
Source§

fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright magenta
Source§

fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright magenta
Source§

fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright purple
Source§

fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright purple
Source§

fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>

Change the foreground color to bright cyan
Source§

fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>

Change the background color to bright cyan
Source§

fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>

Change the foreground color to bright white
Source§

fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>

Change the background color to bright white
Source§

fn bold(&self) -> BoldDisplay<'_, Self>

Make the text bold
Source§

fn dimmed(&self) -> DimDisplay<'_, Self>

Make the text dim
Source§

fn italic(&self) -> ItalicDisplay<'_, Self>

Make the text italicized
Source§

fn underline(&self) -> UnderlineDisplay<'_, Self>

Make the text underlined
Make the text blink
Make the text blink (but fast!)
Source§

fn reversed(&self) -> ReversedDisplay<'_, Self>

Swap the foreground and background colors
Source§

fn hidden(&self) -> HiddenDisplay<'_, Self>

Hide the text
Source§

fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>

Cross out the text
Source§

fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either OwoColorize::fg or a color-specific method, such as OwoColorize::green, Read more
Source§

fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either OwoColorize::bg or a color-specific method, such as OwoColorize::on_yellow, Read more
Source§

fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the foreground color to a specific RGB value.
Source§

fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the background color to a specific RGB value.
Source§

fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>

Sets the foreground color to an RGB value.
Source§

fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>

Sets the background color to an RGB value.
Source§

fn style(&self, style: Style) -> Styled<&Self>

Apply a runtime-determined style
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

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> Pointee for T

Source§

type Metadata = ()

The metadata type for pointers and references to this type.
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, S> SerializeUnsized<S> for T
where T: Serialize<S>, S: Fallible + Writer + ?Sized,

Source§

fn serialize_unsized( &self, serializer: &mut S, ) -> Result<usize, <S as Fallible>::Error>

Writes the object and returns the position of the archived type.
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T> ToSmolStr for T
where T: Display + ?Sized,

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, C> TryComponentsInto<C> for T
where C: TryFromComponents<T>,

Source§

type Error = <C as TryFromComponents<T>>::Error

The error for when try_into_colors fails to cast.
Source§

fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>

Try to cast this collection of color components into a collection of colors. Read more
Source§

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

Source§

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 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.
Source§

impl<T, U> TryIntoColor<U> for T
where U: TryFromColor<T>,

Source§

fn try_into_color(self) -> Result<U, OutOfBounds<U>>

Convert into T, returning ok if the color is inside of its defined range, otherwise an OutOfBounds error is returned which contains the unclamped color. Read more
Source§

impl<C, U> UintsFrom<C> for U
where C: IntoUints<U>,

Source§

fn uints_from(colors: C) -> U

Cast a collection of colors into a collection of unsigned integers.
Source§

impl<C, U> UintsInto<C> for U
where C: FromUints<U>,

Source§

fn uints_into(self) -> C

Cast this collection of unsigned integers into a collection of colors.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> AnyBitPattern for T
where T: Pod,

Source§

impl<T, Right> ClosedAdd<Right> for T
where T: Add<Right, Output = T> + AddAssign<Right>,

Source§

impl<T, Right> ClosedAddAssign<Right> for T
where T: ClosedAdd<Right> + AddAssign<Right>,

Source§

impl<T, Right> ClosedDiv<Right> for T
where T: Div<Right, Output = T> + DivAssign<Right>,

Source§

impl<T, Right> ClosedDivAssign<Right> for T
where T: ClosedDiv<Right> + DivAssign<Right>,

Source§

impl<T, Right> ClosedMul<Right> for T
where T: Mul<Right, Output = T> + MulAssign<Right>,

Source§

impl<T, Right> ClosedMulAssign<Right> for T
where T: ClosedMul<Right> + MulAssign<Right>,

Source§

impl<T> ClosedNeg for T
where T: Neg<Output = T>,

Source§

impl<T, Right> ClosedSub<Right> for T
where T: Sub<Right, Output = T> + SubAssign<Right>,

Source§

impl<T, Right> ClosedSubAssign<Right> for T
where T: ClosedSub<Right> + SubAssign<Right>,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> NoUninit for T
where T: Pod,

Source§

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

Source§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,