Trait MatrixInto

Source
pub trait MatrixInto<T> {
    // Required method
    fn matrix_into(self) -> T;
}
Expand description

Sister trait of MatrixFrom. Basically does the same thing, just with a different syntax.

Required Methods§

Source

fn matrix_into(self) -> T

Method for converting a matrix Matrix<T> to another type.

§Example
use matrix_basic::Matrix;
use matrix_basic::MatrixInto;

let a = Matrix::from(vec![vec![1, 2, 3], vec![0, 1, 2]]).unwrap();
let b = Matrix::from(vec![vec![1.0, 2.0, 3.0], vec![0.0, 1.0, 2.0]]).unwrap();
let c: Matrix<f64> = a.matrix_into(); // Type annotation is needed here


assert_eq!(c, b);

Implementors§

Source§

impl<T: MatrixFrom<S>, S: ToMatrix> MatrixInto<T> for Matrix<S>

Blanket implementation of MatrixInto<T> for Matrix<S> whenever T (which is actually some)Matrix<U> implements MatrixFrom<S>.