Struct ohsl::matrix::Matrix

source ·
pub struct Matrix<T> { /* private fields */ }

Implementations§

source§

impl<T> Matrix<T>

source

pub fn clear(&mut self)

Remove all the elements from the matrix

source§

impl<T: Clone + Number> Matrix<T>

source

pub fn get_row(&self, row: usize) -> Vector<T>

Get a row of the matrix as a vector

source

pub fn get_col(&self, col: usize) -> Vector<T>

Get a column of the matrix as a vector

source

pub fn set_row(&mut self, row: usize, vec: Vector<T>)

Set a row of the matrix using a vector

source

pub fn set_col(&mut self, col: usize, vec: Vector<T>)

Set a column of the matrix using a vector

source

pub fn delete_row(&mut self, row: usize)

Delete a row from the matrix

source

pub fn multiply(&self, vec: Vector<T>) -> Vector<T>

Multiply the matrix by a (column) vector and return a vector

source

pub fn eye(size: usize) -> Self

Create a square identity matrix of specified size

source

pub fn resize(&mut self, n_rows: usize, n_cols: usize)

Resize the matrix (empty entries are appended if necessary)

source

pub fn transpose_in_place(&mut self)

Transpose the matrix in place

source

pub fn transpose(&self) -> Matrix<T>

Return the transpose of the matrix

source

pub fn swap_rows(&mut self, row_1: usize, row_2: usize)

Swap two rows of the matrix

source

pub fn swap_elem( &mut self, row_1: usize, col_1: usize, row_2: usize, col_2: usize )

Swap two elements of the matrix

source

pub fn fill(&mut self, elem: T)

Fill the matrix with specified elements

source

pub fn fill_diag(&mut self, elem: T)

Fill the leading diagonal of the matrix with specified elements

source

pub fn fill_band(&mut self, offset: isize, elem: T)

Fill a diagonal band of the matrix with specified elements ( offset above main diagonal +, below main diagonal - )

source

pub fn fill_tridiag(&mut self, lower: T, diag: T, upper: T)

Fill the main three diagonals of the matrix with specified elements

source§

impl<T: Clone + Copy + Number + Signed + PartialOrd> Matrix<T>

source

pub fn solve_basic(&mut self, b: Vector<T>) -> Vector<T>

Solve the system of equations Ax=b where b is a specified vector using Gaussian elimination (the matrix A is modified in the process)

Examples found in repository?
examples/sparse_linear_system.rs (line 31)
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
fn main() {
    println!( "------------------ Sparse linear system ------------------" );
    println!( "  * Solving the linear system Ax = b, for x, where" );
    let n: usize = 4;
    let mut a = Mat64::new( n, n, 0.0 );
    let mut triplets = Vec::new();
    for i in 0..n {
        a[i][i] = 2.0;
        triplets.push( ( i, i, 2.0 ) );
        if i > 0 {
            a[ i - 1 ][ i ] = 1.0;
            triplets.push( ( i - 1, i, 1.0 ) );
        }
        if i < n - 1 {
            a[ i + 1 ][ i ] = 1.0;
            triplets.push( ( i + 1, i, 1.0 ) );
        }
    }
    println!( "  * A ={}", a );
    let b = Vec64::random( n );
    println!( "  * b^T ={}", b );
    println!( "  * as both dense and sparse linear systems.");
    let dense_x = a.clone().solve_basic( b.clone() );
    println!( "  * The dense system gives the solution vector");
    println!( "  * x^T ={}", dense_x );
    let mut sparse = Sparse::from_triplets( triplets );
    let sparse_x = sparse.solve( b ).unwrap();
    println!( "  * The sparse system gives the solution vector");
    println!( "  * x^T ={}", sparse_x );
    let diff = dense_x - sparse_x;
    println!( "  * The maximum difference between the two is {:+.2e}", diff.norm_inf() );
    println!( "-------------------- FINISHED ---------------------" );
}
More examples
Hide additional examples
examples/linear_systems.rs (line 21)
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
fn main() {
    println!( "------------------ Linear system ------------------" );
    println!( "  * Solving the linear system Ax = b, for x, where" );
    let mut a = Mat64::new( 3, 3, 0.0 );
    a[0][0] = 1.0; a[0][1] = 1.0; a[0][2] =   1.0;
    a[1][0] = 0.0; a[1][1] = 2.0; a[1][2] =   5.0;
    a[2][0] = 2.0; a[2][1] = 5.0; a[2][2] = - 1.0;
    println!( "  * A ={}", a );
    let b = Vec64::create( vec![ 6.0, -4.0, 27.0 ] ); 
    println!( "  * b^T ={}", b );
    let x = a.clone().solve_basic( b );
    println!( "  * gives the solution vector");
    println!( "  * x^T ={}", x );
    println!( "---------------------------------------------------" );
    println!( "  * Lets solve the complex linear system Cy = d where" );
    let mut c = Matrix::<Cmplx>::new( 2, 2, Cmplx::new( 1.0, 1.0 ) );
    c[0][1] = Cmplx::new( -1.0, 0.0 );
    c[1][0] = Cmplx::new( 1.0, -1.0 );
    println!( "  * C ={}", c );
    let mut d = Vector::<Cmplx>::new( 2, Cmplx::new( 0.0, 1.0 ) );
    d[1] = Cmplx::new( 1.0, 0.0 );
    println!( "  * d^T ={}", d );
    println!( "  * Using LU decomposition we find that ");
    let y = c.clone().solve_lu( d );
    println!( "  * y^T ={}", y );
    println!( "---------------------------------------------------" );
    println!( "  * We may also find the determinant of a matrix" );
    println!( "  * |A| = {}", a.clone().determinant() );
    println!( "  * |C| = {}", c.clone().determinant() ); 
    println!( "  * or the inverse of a matrix" );
    let inverse = a.clone().inverse();
    println!( "  * A^-1 =\n{}", inverse );
    println!( "  * C^-1 =\n{}", c.clone().inverse() );
    println!( "  * We can check this by multiplication" );
    println!( "  * I = A * A^-1 =\n{}", a * inverse );
    println!( "  * which is sufficiently accurate for our purposes.");
    println!( "-------------------- FINISHED ---------------------" );
}
source

pub fn lu_decomp_in_place(&mut self) -> (usize, Matrix<T>)

Replace the matrix with its LU decomposition and return the number of pivots and a permutation matrix

source

pub fn solve_lu(&mut self, b: Vector<T>) -> Vector<T>

Solve the system of equations Ax=b where b is a specified vector using LU decomposition (the matrix A is modified in the process)

Examples found in repository?
examples/linear_systems.rs (line 34)
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
fn main() {
    println!( "------------------ Linear system ------------------" );
    println!( "  * Solving the linear system Ax = b, for x, where" );
    let mut a = Mat64::new( 3, 3, 0.0 );
    a[0][0] = 1.0; a[0][1] = 1.0; a[0][2] =   1.0;
    a[1][0] = 0.0; a[1][1] = 2.0; a[1][2] =   5.0;
    a[2][0] = 2.0; a[2][1] = 5.0; a[2][2] = - 1.0;
    println!( "  * A ={}", a );
    let b = Vec64::create( vec![ 6.0, -4.0, 27.0 ] ); 
    println!( "  * b^T ={}", b );
    let x = a.clone().solve_basic( b );
    println!( "  * gives the solution vector");
    println!( "  * x^T ={}", x );
    println!( "---------------------------------------------------" );
    println!( "  * Lets solve the complex linear system Cy = d where" );
    let mut c = Matrix::<Cmplx>::new( 2, 2, Cmplx::new( 1.0, 1.0 ) );
    c[0][1] = Cmplx::new( -1.0, 0.0 );
    c[1][0] = Cmplx::new( 1.0, -1.0 );
    println!( "  * C ={}", c );
    let mut d = Vector::<Cmplx>::new( 2, Cmplx::new( 0.0, 1.0 ) );
    d[1] = Cmplx::new( 1.0, 0.0 );
    println!( "  * d^T ={}", d );
    println!( "  * Using LU decomposition we find that ");
    let y = c.clone().solve_lu( d );
    println!( "  * y^T ={}", y );
    println!( "---------------------------------------------------" );
    println!( "  * We may also find the determinant of a matrix" );
    println!( "  * |A| = {}", a.clone().determinant() );
    println!( "  * |C| = {}", c.clone().determinant() ); 
    println!( "  * or the inverse of a matrix" );
    let inverse = a.clone().inverse();
    println!( "  * A^-1 =\n{}", inverse );
    println!( "  * C^-1 =\n{}", c.clone().inverse() );
    println!( "  * We can check this by multiplication" );
    println!( "  * I = A * A^-1 =\n{}", a * inverse );
    println!( "  * which is sufficiently accurate for our purposes.");
    println!( "-------------------- FINISHED ---------------------" );
}
source

pub fn determinant(&self) -> T

Calculate the determinant of the matrix ( via LU decomposition )

Examples found in repository?
examples/linear_systems.rs (line 38)
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
fn main() {
    println!( "------------------ Linear system ------------------" );
    println!( "  * Solving the linear system Ax = b, for x, where" );
    let mut a = Mat64::new( 3, 3, 0.0 );
    a[0][0] = 1.0; a[0][1] = 1.0; a[0][2] =   1.0;
    a[1][0] = 0.0; a[1][1] = 2.0; a[1][2] =   5.0;
    a[2][0] = 2.0; a[2][1] = 5.0; a[2][2] = - 1.0;
    println!( "  * A ={}", a );
    let b = Vec64::create( vec![ 6.0, -4.0, 27.0 ] ); 
    println!( "  * b^T ={}", b );
    let x = a.clone().solve_basic( b );
    println!( "  * gives the solution vector");
    println!( "  * x^T ={}", x );
    println!( "---------------------------------------------------" );
    println!( "  * Lets solve the complex linear system Cy = d where" );
    let mut c = Matrix::<Cmplx>::new( 2, 2, Cmplx::new( 1.0, 1.0 ) );
    c[0][1] = Cmplx::new( -1.0, 0.0 );
    c[1][0] = Cmplx::new( 1.0, -1.0 );
    println!( "  * C ={}", c );
    let mut d = Vector::<Cmplx>::new( 2, Cmplx::new( 0.0, 1.0 ) );
    d[1] = Cmplx::new( 1.0, 0.0 );
    println!( "  * d^T ={}", d );
    println!( "  * Using LU decomposition we find that ");
    let y = c.clone().solve_lu( d );
    println!( "  * y^T ={}", y );
    println!( "---------------------------------------------------" );
    println!( "  * We may also find the determinant of a matrix" );
    println!( "  * |A| = {}", a.clone().determinant() );
    println!( "  * |C| = {}", c.clone().determinant() ); 
    println!( "  * or the inverse of a matrix" );
    let inverse = a.clone().inverse();
    println!( "  * A^-1 =\n{}", inverse );
    println!( "  * C^-1 =\n{}", c.clone().inverse() );
    println!( "  * We can check this by multiplication" );
    println!( "  * I = A * A^-1 =\n{}", a * inverse );
    println!( "  * which is sufficiently accurate for our purposes.");
    println!( "-------------------- FINISHED ---------------------" );
}
source

pub fn inverse(&self) -> Matrix<T>

Return the inverse of the matrix ( via LU decomposition )

Examples found in repository?
examples/linear_systems.rs (line 41)
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
fn main() {
    println!( "------------------ Linear system ------------------" );
    println!( "  * Solving the linear system Ax = b, for x, where" );
    let mut a = Mat64::new( 3, 3, 0.0 );
    a[0][0] = 1.0; a[0][1] = 1.0; a[0][2] =   1.0;
    a[1][0] = 0.0; a[1][1] = 2.0; a[1][2] =   5.0;
    a[2][0] = 2.0; a[2][1] = 5.0; a[2][2] = - 1.0;
    println!( "  * A ={}", a );
    let b = Vec64::create( vec![ 6.0, -4.0, 27.0 ] ); 
    println!( "  * b^T ={}", b );
    let x = a.clone().solve_basic( b );
    println!( "  * gives the solution vector");
    println!( "  * x^T ={}", x );
    println!( "---------------------------------------------------" );
    println!( "  * Lets solve the complex linear system Cy = d where" );
    let mut c = Matrix::<Cmplx>::new( 2, 2, Cmplx::new( 1.0, 1.0 ) );
    c[0][1] = Cmplx::new( -1.0, 0.0 );
    c[1][0] = Cmplx::new( 1.0, -1.0 );
    println!( "  * C ={}", c );
    let mut d = Vector::<Cmplx>::new( 2, Cmplx::new( 0.0, 1.0 ) );
    d[1] = Cmplx::new( 1.0, 0.0 );
    println!( "  * d^T ={}", d );
    println!( "  * Using LU decomposition we find that ");
    let y = c.clone().solve_lu( d );
    println!( "  * y^T ={}", y );
    println!( "---------------------------------------------------" );
    println!( "  * We may also find the determinant of a matrix" );
    println!( "  * |A| = {}", a.clone().determinant() );
    println!( "  * |C| = {}", c.clone().determinant() ); 
    println!( "  * or the inverse of a matrix" );
    let inverse = a.clone().inverse();
    println!( "  * A^-1 =\n{}", inverse );
    println!( "  * C^-1 =\n{}", c.clone().inverse() );
    println!( "  * We can check this by multiplication" );
    println!( "  * I = A * A^-1 =\n{}", a * inverse );
    println!( "  * which is sufficiently accurate for our purposes.");
    println!( "-------------------- FINISHED ---------------------" );
}
source§

impl Matrix<f64>

source

pub fn norm_1(&self) -> f64

Return the matrix one-norm (max absolute column sum)

source

pub fn norm_inf(&self) -> f64

Return the matrix inf-norm (max absolute row sum)

source

pub fn norm_p(&self, p: f64) -> f64

Return the matrix p-norm (p=2 is Frobenius, p=inf is max norm)

source

pub fn norm_frob(&self) -> f64

Return the matrix Frobenius norm

source

pub fn norm_max(&self) -> f64

Return the entrywise max-norm of the matrix

source

pub fn jacobian(point: Vec64, func: &dyn Fn(Vec64) -> Vec64, delta: f64) -> Self

Create the Jacobian matrix of a vector valued function at a point using finite-differences

source§

impl<T> Matrix<T>

source

pub fn empty() -> Self

Create a new matrix of unspecified size

source

pub fn create(mat: Vec<Vector<T>>) -> Self

Create a matrix from an std::vec::Vec<Vector<T>>

source

pub fn rows(&self) -> usize

Return the number of rows in the matrix

source

pub fn cols(&self) -> usize

Return the number of columns in the matrix

source

pub fn numel(&self) -> usize

Return the number of elements in the matrix

source§

impl<T: Clone + Number> Matrix<T>

source

pub fn new(rows: usize, cols: usize, elem: T) -> Self

Create a new matrix of specified size

Examples found in repository?
examples/sparse_linear_system.rs (line 13)
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
fn main() {
    println!( "------------------ Sparse linear system ------------------" );
    println!( "  * Solving the linear system Ax = b, for x, where" );
    let n: usize = 4;
    let mut a = Mat64::new( n, n, 0.0 );
    let mut triplets = Vec::new();
    for i in 0..n {
        a[i][i] = 2.0;
        triplets.push( ( i, i, 2.0 ) );
        if i > 0 {
            a[ i - 1 ][ i ] = 1.0;
            triplets.push( ( i - 1, i, 1.0 ) );
        }
        if i < n - 1 {
            a[ i + 1 ][ i ] = 1.0;
            triplets.push( ( i + 1, i, 1.0 ) );
        }
    }
    println!( "  * A ={}", a );
    let b = Vec64::random( n );
    println!( "  * b^T ={}", b );
    println!( "  * as both dense and sparse linear systems.");
    let dense_x = a.clone().solve_basic( b.clone() );
    println!( "  * The dense system gives the solution vector");
    println!( "  * x^T ={}", dense_x );
    let mut sparse = Sparse::from_triplets( triplets );
    let sparse_x = sparse.solve( b ).unwrap();
    println!( "  * The sparse system gives the solution vector");
    println!( "  * x^T ={}", sparse_x );
    let diff = dense_x - sparse_x;
    println!( "  * The maximum difference between the two is {:+.2e}", diff.norm_inf() );
    println!( "-------------------- FINISHED ---------------------" );
}
More examples
Hide additional examples
examples/linear_systems.rs (line 14)
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
fn main() {
    println!( "------------------ Linear system ------------------" );
    println!( "  * Solving the linear system Ax = b, for x, where" );
    let mut a = Mat64::new( 3, 3, 0.0 );
    a[0][0] = 1.0; a[0][1] = 1.0; a[0][2] =   1.0;
    a[1][0] = 0.0; a[1][1] = 2.0; a[1][2] =   5.0;
    a[2][0] = 2.0; a[2][1] = 5.0; a[2][2] = - 1.0;
    println!( "  * A ={}", a );
    let b = Vec64::create( vec![ 6.0, -4.0, 27.0 ] ); 
    println!( "  * b^T ={}", b );
    let x = a.clone().solve_basic( b );
    println!( "  * gives the solution vector");
    println!( "  * x^T ={}", x );
    println!( "---------------------------------------------------" );
    println!( "  * Lets solve the complex linear system Cy = d where" );
    let mut c = Matrix::<Cmplx>::new( 2, 2, Cmplx::new( 1.0, 1.0 ) );
    c[0][1] = Cmplx::new( -1.0, 0.0 );
    c[1][0] = Cmplx::new( 1.0, -1.0 );
    println!( "  * C ={}", c );
    let mut d = Vector::<Cmplx>::new( 2, Cmplx::new( 0.0, 1.0 ) );
    d[1] = Cmplx::new( 1.0, 0.0 );
    println!( "  * d^T ={}", d );
    println!( "  * Using LU decomposition we find that ");
    let y = c.clone().solve_lu( d );
    println!( "  * y^T ={}", y );
    println!( "---------------------------------------------------" );
    println!( "  * We may also find the determinant of a matrix" );
    println!( "  * |A| = {}", a.clone().determinant() );
    println!( "  * |C| = {}", c.clone().determinant() ); 
    println!( "  * or the inverse of a matrix" );
    let inverse = a.clone().inverse();
    println!( "  * A^-1 =\n{}", inverse );
    println!( "  * C^-1 =\n{}", c.clone().inverse() );
    println!( "  * We can check this by multiplication" );
    println!( "  * I = A * A^-1 =\n{}", a * inverse );
    println!( "  * which is sufficiently accurate for our purposes.");
    println!( "-------------------- FINISHED ---------------------" );
}
source§

impl<T: Display> Matrix<T>

source

pub fn output(&self, filename: &str)

Print the matrix to a file

Trait Implementations§

source§

impl<T: Clone + Number> Add for Matrix<T>

source§

fn add(self, plus: Self) -> Self::Output

Add the elements of two matrices together ( binary + )

§

type Output = Matrix<T>

The resulting type after applying the + operator.
source§

impl<T: Clone + Number> AddAssign<T> for Matrix<T>

source§

fn add_assign(&mut self, rhs: T)

Add the same value to every element in a mutable matrix

source§

impl<T: Clone + Number> AddAssign for Matrix<T>

source§

fn add_assign(&mut self, rhs: Self)

Add a matrix to a mutable matrix and assign the result ( += )

source§

impl<T: Clone> Clone for Matrix<T>

source§

fn clone(&self) -> Self

Clone the matrix

1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<T> Debug for Matrix<T>where T: Debug,

source§

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

Format the output

source§

impl<T> Display for Matrix<T>where T: Debug,

source§

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

Format the output

source§

impl<T: Clone + Number> Div<T> for Matrix<T>

source§

fn div(self, scalar: T) -> Self::Output

Divide a matrix by a scalar (matrix / scalar)

§

type Output = Matrix<T>

The resulting type after applying the / operator.
source§

impl<T: Clone + Number> DivAssign<T> for Matrix<T>

source§

fn div_assign(&mut self, rhs: T)

Divide a mutable matrix by a scalar (matrix /= scalar)

source§

impl<T> Index<usize> for Matrix<T>

source§

fn index<'a>(&'a self, index: usize) -> &'a Vector<T>

Indexing operator [] (read only)

§

type Output = Vector<T>

The returned type after indexing.
source§

impl<T> IndexMut<usize> for Matrix<T>

source§

fn index_mut(&mut self, index: usize) -> &mut Vector<T>

Indexing operator [] (read/write)

source§

impl Mul<Matrix<f64>> for f64

source§

fn mul(self, matrix: Matrix<f64>) -> Self::Output

Allow multiplication on the left by f64 (f64 * matrix)

§

type Output = Matrix<f64>

The resulting type after applying the * operator.
source§

impl<T: Clone + Number> Mul<T> for Matrix<T>

source§

fn mul(self, scalar: T) -> Self::Output

Multiply a matrix by a scalar (matrix * scalar)

§

type Output = Matrix<T>

The resulting type after applying the * operator.
source§

impl<T: Clone + Number> Mul<Vector<T>> for Matrix<T>

source§

fn mul(self, vec: Vector<T>) -> Vector<T>

Multiply a matrix with a (column) vector ( matrix * vector )

§

type Output = Vector<T>

The resulting type after applying the * operator.
source§

impl<T: Clone + Number> Mul for Matrix<T>

source§

fn mul(self, mul: Self) -> Self::Output

Multiply two matrices together ( matrix * matrix )

§

type Output = Matrix<T>

The resulting type after applying the * operator.
source§

impl<T: Clone + Number> MulAssign<T> for Matrix<T>

source§

fn mul_assign(&mut self, rhs: T)

Multiply a mutable matrix by a scalar (matrix *= scalar)

source§

impl<T: Clone + Neg<Output = T>> Neg for Matrix<T>

source§

fn neg(self) -> Self::Output

Return the unary negation ( unary - ) of each element

§

type Output = Matrix<T>

The resulting type after applying the - operator.
source§

impl<T: Clone + Number> Sub for Matrix<T>

source§

fn sub(self, minus: Self) -> Self::Output

Subtract the elements of one matrix from another ( binary - )

§

type Output = Matrix<T>

The resulting type after applying the - operator.
source§

impl<T: Clone + Number> SubAssign<T> for Matrix<T>

source§

fn sub_assign(&mut self, rhs: T)

Subtract the same value from every element in a mutable matrix

source§

impl<T: Clone + Number> SubAssign for Matrix<T>

source§

fn sub_assign(&mut self, rhs: Self)

Subtract a matrix from a mutable matrix and assign the result ( -= )

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

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

source§

default fn to_string(&self) -> String

Converts the given value to a String. 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.
§

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

§

fn vzip(self) -> V

source§

impl<T, Rhs> AssignOperations<Rhs> for Twhere T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs>,