Skip to main content

Mat3

Struct Mat3 

Source
#[repr(C)]
pub struct Mat3<T> { pub a11: T, pub a12: T, pub a13: T, pub a21: T, pub a22: T, pub a23: T, pub a31: T, pub a32: T, pub a33: T, }
Expand description

3D transformation matrix.

Each field aij represents the i-th row and j-th column of the matrix.

Row-major storage with column-major semantics.

Stored in row-major order (fields appear in reading order), but interpreted as column-major: each column is a transformed basis vector, and matrices are applied to column vectors via mat * vec.

Fields§

§a11: T§a12: T§a13: T§a21: T§a22: T§a23: T§a31: T§a32: T§a33: T

Implementations§

Source§

impl<T> Mat3<T>

Source

pub const fn new( a11: T, a12: T, a13: T, a21: T, a22: T, a23: T, a31: T, a32: T, a33: T, ) -> Mat3<T>

Constructs a new matrix from components.

Source§

impl<T: Zero> Mat3<T>

Source

pub const ZERO: Mat3<T>

Zero matrix.

Source§

impl<T: Zero + One> Mat3<T>

Source

pub const IDENTITY: Mat3<T>

Identity matrix.

Source§

impl<T: Float> Mat3<T>

Source

pub fn scaling(scale: Vec3<T>) -> Mat3<T>

Scaling matrix.

let mat = cvmath::Mat3::scaling(cvmath::Vec3(2.0, 3.0, 4.0));
let value = mat * cvmath::Vec3(4.0, 5.0, 6.0);
let expected = cvmath::Vec3(8.0, 15.0, 24.0);
assert_eq!(expected, value);
Source

pub fn rotation(axis: Vec3<T>, angle: Angle<T>) -> Mat3<T>

Rotation matrix around an axis.

let mat = cvmath::Mat3::rotation(cvmath::Vec3::Z, cvmath::deg(90.0));
let value = (mat * cvmath::Vec3(1.0f64, 1.0, 1.0)).cast::<f32>();
let expected = cvmath::Vec3(-1.0f32, 1.0, 1.0);
assert_eq!(expected, value);
Source

pub fn rotation_between(from: Vec3<T>, to: Vec3<T>) -> Mat3<T>

Returns the shortest rotation that aligns vector from with vector to.

The resulting matrix R satisfies:

R * from = to

Both vectors are expected to be normalized. The implementation avoids trigonometric functions.

This produces the minimal rotation between the two directions. The behavior is undefined if from and to are opposite (180° apart), or if either vector is zero-length, since the rotation axis is not uniquely defined.

This is useful for constructing an orientation matrix that points one direction vector toward another.

let from = cvmath::Vec3(1.0, 0.0, 0.0);
let to = cvmath::Vec3(0.0, 1.0, 0.0);
let mat = cvmath::Mat3::rotation_between(from, to);
let value = (mat * from).cast::<f32>();
let expected = to.cast::<f32>();
assert_eq!(expected, value);
Source

pub fn outer_product(column: Vec3<T>, row: Vec3<T>) -> Mat3<T>

Outer product of two vectors.

let column = cvmath::Vec3(1.0, 2.0, 3.0);
let row = cvmath::Vec3(4.0, 5.0, 6.0);
let mat = cvmath::Mat3::outer_product(column, row);
let expected = cvmath::Mat3(4.0, 5.0, 6.0, 8.0, 10.0, 12.0, 12.0, 15.0, 18.0);
assert_eq!(expected, mat);
Source

pub fn projection(normal: Vec3<T>) -> Mat3<T>

Projection matrix.

Projects onto the plane defined by the given normal, returning the zero matrix if the normal is zero.

let mat = cvmath::Mat3::projection(cvmath::Vec3(0.0f64, 0.0, 2.0));
let value = mat * cvmath::Vec3(2.0, 3.0, 4.0);
let expected = cvmath::Vec3(2.0, 3.0, 0.0);
assert_eq!(expected, value);
Source

pub fn reflection(normal: Vec3<T>) -> Mat3<T>

Reflection matrix.

Reflects across the plane defined by the given normal, returning a point reflection around the origin if the normal is zero.

let mat = cvmath::Mat3::reflection(cvmath::Vec3(0.0f64, 0.0, 2.0));
let value = mat * cvmath::Vec3(2.0, 3.0, 4.0);
let expected = cvmath::Vec3(2.0, 3.0, -4.0);
assert_eq!(expected, value);
Source§

impl<T> Mat3<T>

Source

pub fn cast<U>(self) -> Mat3<U>
where T: CastTo<U>,

Casts to a matrix of different type with the same dimensions.

Source§

impl<T> Mat3<T>

Source

pub fn mat2(self) -> Mat2<T>

Converts to a Mat2 matrix.

let value = cvmath::Mat3(1, 2, 3, 4, 5, 6, 7, 8, 9).mat2();
let expected = cvmath::Mat2(1, 2, 4, 5);
assert_eq!(expected, value);
Source

pub fn transform3(self) -> Transform3<T>
where T: Zero,

Converts to a Transform3 matrix.

let mat = cvmath::Mat3(1, 2, 3, 4, 5, 6, 7, 8, 9).transform3();
let value = mat.into_row_major();
let expected = [[1, 2, 3, 0], [4, 5, 6, 0], [7, 8, 9, 0]];
assert_eq!(expected, value);
Source

pub fn translate(self, trans: Vec3<T>) -> Transform3<T>

Adds a translation to the matrix.

let mat = cvmath::Mat3::IDENTITY.translate(cvmath::Vec3(5, 6, 7));
let value = mat.into_row_major();
let expected = [[1, 0, 0, 5], [0, 1, 0, 6], [0, 0, 1, 7]];
assert_eq!(expected, value);
Source§

impl<T> Mat3<T>

Source

pub fn from_row_major(mat: [[T; 3]; 3]) -> Mat3<T>

Imports the matrix from a row-major layout.

let mat = cvmath::Mat3::from_row_major([[1, 2, 3], [4, 5, 6], [7, 8, 9]]);
let expected = cvmath::Mat3(1, 2, 3, 4, 5, 6, 7, 8, 9);
assert_eq!(expected, mat);
Source

pub fn from_column_major(mat: [[T; 3]; 3]) -> Mat3<T>

Imports the matrix from a column-major layout.

let mat = cvmath::Mat3::from_column_major([[1, 4, 7], [2, 5, 8], [3, 6, 9]]);
let expected = cvmath::Mat3(1, 2, 3, 4, 5, 6, 7, 8, 9);
assert_eq!(expected, mat);
Source

pub fn into_row_major(self) -> [[T; 3]; 3]

Exports the matrix as a row-major array.

let value = cvmath::Mat3(1, 2, 3, 4, 5, 6, 7, 8, 9).into_row_major();
let expected = [[1, 2, 3], [4, 5, 6], [7, 8, 9]];
assert_eq!(expected, value);
Source

pub fn into_column_major(self) -> [[T; 3]; 3]

Exports the matrix as a column-major array.

let value = cvmath::Mat3(1, 2, 3, 4, 5, 6, 7, 8, 9).into_column_major();
let expected = [[1, 4, 7], [2, 5, 8], [3, 6, 9]];
assert_eq!(expected, value);
Source§

impl<T> Mat3<T>

Source

pub fn compose(x: Vec3<T>, y: Vec3<T>, z: Vec3<T>) -> Mat3<T>

Composes the matrix from basis vectors.

let mat = cvmath::Mat3::compose(cvmath::Vec3(1, 2, 3), cvmath::Vec3(4, 5, 6), cvmath::Vec3(7, 8, 9));
let value = mat.into_row_major();
let expected = [[1, 4, 7], [2, 5, 8], [3, 6, 9]];
assert_eq!(expected, value);
Source

pub fn x(self) -> Vec3<T>

Gets the transformed X basis vector.

let value = cvmath::Mat3(1, 2, 3, 4, 5, 6, 7, 8, 9).x();
let expected = cvmath::Vec3(1, 4, 7);
assert_eq!(expected, value);
Source

pub fn y(self) -> Vec3<T>

Gets the transformed Y basis vector.

let value = cvmath::Mat3(1, 2, 3, 4, 5, 6, 7, 8, 9).y();
let expected = cvmath::Vec3(2, 5, 8);
assert_eq!(expected, value);
Source

pub fn z(self) -> Vec3<T>

Gets the transformed Z basis vector.

let value = cvmath::Mat3(1, 2, 3, 4, 5, 6, 7, 8, 9).z();
let expected = cvmath::Vec3(3, 6, 9);
assert_eq!(expected, value);
Source§

impl<T: Scalar> Mat3<T>

Source

pub fn det(self) -> T

Computes the determinant.

let value = cvmath::Mat3::scaling(cvmath::Vec3(2.0, 3.0, 4.0)).det();
assert_eq!(24.0, value);
Source

pub fn trace(self) -> T

Computes the trace.

let value = cvmath::Mat3::scaling(cvmath::Vec3(2.0, 3.0, 4.0)).trace();
assert_eq!(9.0, value);
Source

pub fn flat_norm_sqr(self) -> T

Computes the squared Frobenius norm (sum of squares of all matrix elements).

This measure is useful for quickly checking matrix magnitude or comparing matrices without the cost of a square root operation.

To check if a matrix is effectively zero, test if flat_norm_sqr() is below a small epsilon threshold.

let value = cvmath::Mat3::scaling(cvmath::Vec3(2.0, 3.0, 4.0)).flat_norm_sqr();
assert_eq!(29.0, value);
Source

pub fn try_invert(self) -> Option<Mat3<T>>
where T: Float,

Attempts to invert the matrix.

let value = cvmath::Mat3::scaling(cvmath::Vec3(2.0, 4.0, 8.0)).try_invert();
let expected = Some(cvmath::Mat3::scaling(cvmath::Vec3(0.5, 0.25, 0.125)));
assert_eq!(expected, value);
Source

pub fn inverse(self) -> Mat3<T>
where T: Float,

Computes the inverse matrix.

Returns the zero matrix if the determinant is exactly zero.

let value = cvmath::Mat3::scaling(cvmath::Vec3(2.0, 4.0, 8.0)).inverse();
let expected = cvmath::Mat3::scaling(cvmath::Vec3(0.5, 0.25, 0.125));
assert_eq!(expected, value);
Source

pub fn transpose(self) -> Mat3<T>

Returns the transposed matrix.

let mat = cvmath::Mat3(1, 2, 3, 4, 5, 6, 7, 8, 9);
let value = mat.transpose();
let expected = cvmath::Mat3(1, 4, 7, 2, 5, 8, 3, 6, 9);
assert_eq!(expected, value);
Source

pub fn adjugate(self) -> Mat3<T>

Computes the adjugate matrix.

let value = cvmath::Mat3::scaling(cvmath::Vec3(2.0, 3.0, 4.0)).adjugate();
let expected = cvmath::Mat3::scaling(cvmath::Vec3(12.0, 8.0, 6.0));
assert_eq!(expected, value);
Source

pub fn around(self, origin: Vec3<T>) -> Transform3<T>
where T: Float,

Applies the transformation around a given origin.

let rotation = cvmath::Mat3::rotation(cvmath::Vec3::Z, cvmath::deg(90.0));
let mat = rotation.around(cvmath::Vec3(2.0f64, 3.0, 4.0));
let value = (mat * cvmath::Vec3(3.0, 3.0, 4.0)).cast::<f32>();
let expected = cvmath::Vec3(2.0f32, 4.0, 4.0);
assert_eq!(expected, value);
Source§

impl<T: Float> Mat3<T>

Source

pub fn powi(self, exp: i32) -> Mat3<T>

Raises the matrix to an integer power.

let axis = cvmath::Vec3(1.0, 2.0, 3.0).norm();
let mat = cvmath::Mat3::rotation(axis, cvmath::deg(60.0));
let value = mat.powi(-2).cast::<f32>();
let expected = cvmath::Mat3::rotation(axis, cvmath::deg(60.0) * -2.0).cast::<f32>();
assert_eq!(expected, value);

Trait Implementations§

Source§

impl<T: Copy + Add<Output = T>> Add for Mat3<T>

Source§

type Output = Mat3<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Mat3<T>) -> Mat3<T>

Performs the + operation. Read more
Source§

impl<T> Add<&Mat3<T>> for Mat3<T>
where Mat3<T>: Add<Mat3<T>, Output = Mat3<T>> + Copy,

Source§

type Output = Mat3<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Mat3<T>) -> Mat3<T>

Performs the + operation. Read more
Source§

impl<T> Add<&Mat3<T>> for &Mat3<T>
where Mat3<T>: Copy + Add<Mat3<T>, Output = Mat3<T>>,

Source§

type Output = Mat3<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Mat3<T>) -> Mat3<T>

Performs the + operation. Read more
Source§

impl<T> Add<Mat3<T>> for &Mat3<T>
where Mat3<T>: Copy + Add<Mat3<T>, Output = Mat3<T>>,

Source§

type Output = Mat3<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Mat3<T>) -> Mat3<T>

Performs the + operation. Read more
Source§

impl<T: Copy + AddAssign> AddAssign for Mat3<T>

Source§

fn add_assign(&mut self, rhs: Mat3<T>)

Performs the += operation. Read more
Source§

impl<T> AddAssign<&Mat3<T>> for Mat3<T>
where Mat3<T>: AddAssign<Mat3<T>> + Copy,

Source§

fn add_assign(&mut self, rhs: &Mat3<T>)

Performs the += operation. Read more
Source§

impl<T: Clone> Clone for Mat3<T>

Source§

fn clone(&self) -> Mat3<T>

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<T: Copy> Copy for Mat3<T>

Source§

impl<T: Debug> Debug for Mat3<T>

Source§

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

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

impl<T: Default> Default for Mat3<T>

Source§

fn default() -> Mat3<T>

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

impl<T: Display> Display for Mat3<T>

Source§

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

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

impl<T: Zero + One> From<Mat3<T>> for Mat4<T>

Source§

fn from(mat: Mat3<T>) -> Mat4<T>

Converts to this type from the input type.
Source§

impl<T: Zero + One> From<Transform2<T>> for Mat3<T>

Source§

fn from(mat: Transform2<T>) -> Mat3<T>

Converts to this type from the input type.
Source§

impl<T: FromStr> FromStr for Mat3<T>

Source§

type Err = ParseMatrixError<<T as FromStr>::Err>

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl<T: Scalar> Lerp for Mat3<T>

Source§

type T = T

Source§

fn lerp(self, rhs: Mat3<T>, t: T) -> Mat3<T>

Source§

impl<T: Copy + Add<Output = T> + Mul<Output = T>> Mul for Mat3<T>

Source§

type Output = Mat3<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Mat3<T>) -> Mat3<T>

Performs the * operation. Read more
Source§

impl<T> Mul<&Mat3<T>> for Mat3<T>
where Mat3<T>: Mul<Mat3<T>, Output = Mat3<T>> + Copy,

Source§

type Output = Mat3<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Mat3<T>) -> Mat3<T>

Performs the * operation. Read more
Source§

impl<T> Mul<&Mat3<T>> for &Mat3<T>
where Mat3<T>: Copy + Mul<Mat3<T>, Output = Mat3<T>>,

Source§

type Output = Mat3<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Mat3<T>) -> Mat3<T>

Performs the * operation. Read more
Source§

impl<T> Mul<&T> for Mat3<T>
where Mat3<T>: Mul<T, Output = Mat3<T>>, T: Copy,

Source§

type Output = Mat3<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &T) -> Mat3<T>

Performs the * operation. Read more
Source§

impl<T> Mul<&T> for &Mat3<T>
where Mat3<T>: Copy + Mul<T, Output = Mat3<T>>, T: Copy,

Source§

type Output = Mat3<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &T) -> Mat3<T>

Performs the * operation. Read more
Source§

impl<T> Mul<&Vec3<T>> for Mat3<T>
where Mat3<T>: Mul<Vec3<T>, Output = Vec3<T>>, Vec3<T>: Copy,

Source§

type Output = Vec3<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Vec3<T>) -> Vec3<T>

Performs the * operation. Read more
Source§

impl<T> Mul<&Vec3<T>> for &Mat3<T>
where Mat3<T>: Copy + Mul<Vec3<T>, Output = Vec3<T>>, Vec3<T>: Copy,

Source§

type Output = Vec3<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Vec3<T>) -> Vec3<T>

Performs the * operation. Read more
Source§

impl<T> Mul<Mat3<T>> for &Mat3<T>
where Mat3<T>: Copy + Mul<Mat3<T>, Output = Mat3<T>>,

Source§

type Output = Mat3<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Mat3<T>) -> Mat3<T>

Performs the * operation. Read more
Source§

impl<T: Copy + Add<Output = T> + Mul<Output = T>> Mul<Mat3<T>> for Transform3<T>

Source§

type Output = Transform3<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Mat3<T>) -> Transform3<T>

Performs the * operation. Read more
Source§

impl<T: Copy + Mul<Output = T>> Mul<T> for Mat3<T>

Source§

type Output = Mat3<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: T) -> Mat3<T>

Performs the * operation. Read more
Source§

impl<T> Mul<T> for &Mat3<T>
where Mat3<T>: Copy + Mul<T, Output = Mat3<T>>,

Source§

type Output = Mat3<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: T) -> Mat3<T>

Performs the * operation. Read more
Source§

impl<T: Copy + Add<Output = T> + Mul<Output = T>> Mul<Transform2<T>> for Mat3<T>

Source§

type Output = Mat3<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Transform2<T>) -> Mat3<T>

Performs the * operation. Read more
Source§

impl<T: Copy + Add<Output = T> + Mul<Output = T>> Mul<Vec3<T>> for Mat3<T>

Source§

type Output = Vec3<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Vec3<T>) -> Vec3<T>

Performs the * operation. Read more
Source§

impl<T> Mul<Vec3<T>> for &Mat3<T>
where Mat3<T>: Copy + Mul<Vec3<T>, Output = Vec3<T>>,

Source§

type Output = Vec3<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Vec3<T>) -> Vec3<T>

Performs the * operation. Read more
Source§

impl<T: Copy + Add<Output = T> + Mul<Output = T>> MulAssign for Mat3<T>

Source§

fn mul_assign(&mut self, rhs: Mat3<T>)

Performs the *= operation. Read more
Source§

impl<T> MulAssign<&Mat3<T>> for Mat3<T>
where Mat3<T>: MulAssign<Mat3<T>> + Copy,

Source§

fn mul_assign(&mut self, rhs: &Mat3<T>)

Performs the *= operation. Read more
Source§

impl<T> MulAssign<&T> for Mat3<T>
where Mat3<T>: MulAssign<T>, T: Copy,

Source§

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

Performs the *= operation. Read more
Source§

impl<T: Copy + Add<Output = T> + Mul<Output = T>> MulAssign<Mat3<T>> for Transform3<T>

Source§

fn mul_assign(&mut self, rhs: Mat3<T>)

Performs the *= operation. Read more
Source§

impl<T: Copy + MulAssign> MulAssign<T> for Mat3<T>

Source§

fn mul_assign(&mut self, rhs: T)

Performs the *= operation. Read more
Source§

impl<T: Copy + Add<Output = T> + Mul<Output = T>> MulAssign<Transform2<T>> for Mat3<T>

Source§

fn mul_assign(&mut self, rhs: Transform2<T>)

Performs the *= operation. Read more
Source§

impl<T: Neg<Output = T>> Neg for Mat3<T>

Source§

type Output = Mat3<T>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Mat3<T>

Performs the unary - operation. Read more
Source§

impl<T> Neg for &Mat3<T>
where Mat3<T>: Copy + Neg<Output = Mat3<T>>,

Source§

type Output = Mat3<T>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Mat3<T>

Performs the unary - operation. Read more
Source§

impl<T: PartialEq> PartialEq for Mat3<T>

Source§

fn eq(&self, other: &Mat3<T>) -> 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<T: PartialEq> StructuralPartialEq for Mat3<T>

Source§

impl<T: Copy + Sub<Output = T>> Sub for Mat3<T>

Source§

type Output = Mat3<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Mat3<T>) -> Mat3<T>

Performs the - operation. Read more
Source§

impl<T> Sub<&Mat3<T>> for Mat3<T>
where Mat3<T>: Sub<Mat3<T>, Output = Mat3<T>> + Copy,

Source§

type Output = Mat3<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Mat3<T>) -> Mat3<T>

Performs the - operation. Read more
Source§

impl<T> Sub<&Mat3<T>> for &Mat3<T>
where Mat3<T>: Copy + Sub<Mat3<T>, Output = Mat3<T>>,

Source§

type Output = Mat3<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Mat3<T>) -> Mat3<T>

Performs the - operation. Read more
Source§

impl<T> Sub<Mat3<T>> for &Mat3<T>
where Mat3<T>: Copy + Sub<Mat3<T>, Output = Mat3<T>>,

Source§

type Output = Mat3<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Mat3<T>) -> Mat3<T>

Performs the - operation. Read more
Source§

impl<T: Copy + SubAssign> SubAssign for Mat3<T>

Source§

fn sub_assign(&mut self, rhs: Mat3<T>)

Performs the -= operation. Read more
Source§

impl<T> SubAssign<&Mat3<T>> for Mat3<T>
where Mat3<T>: SubAssign<Mat3<T>> + Copy,

Source§

fn sub_assign(&mut self, rhs: &Mat3<T>)

Performs the -= operation. Read more

Auto Trait Implementations§

§

impl<T> Freeze for Mat3<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Mat3<T>
where T: RefUnwindSafe,

§

impl<T> Send for Mat3<T>
where T: Send,

§

impl<T> Sync for Mat3<T>
where T: Sync,

§

impl<T> Unpin for Mat3<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for Mat3<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for Mat3<T>
where T: UnwindSafe,

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> 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> 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> 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 = 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.