matreex 0.44.4

A simple matrix implementation.
Documentation
/// Creates a new [`Matrix<T>`] from a literal.
///
/// > I witnessed His decree:
/// >
/// > > Let there be matrix!
/// >
/// > Thus, [`matrix!`] was brought forth into existence.
///
/// # Examples
///
/// ```
/// use matreex::{Matrix, matrix};
///
/// let foo: Matrix<i32> = matrix![];
/// let bar = matrix![[0; 3]; 2];
/// let baz = matrix![[1, 2, 3]; 2];
/// let qux = matrix![[1, 2, 3], [4, 5, 6]];
/// ```
///
/// [`Matrix<T>`]: crate::Matrix
/// [`matrix!`]: crate::matrix!
#[macro_export]
macro_rules! matrix {
    [] => {{
        use $crate::Matrix;

        Matrix::<_>::new()
    }};

    [[$elem:expr; $ncols:expr]; $nrows:expr] => {{
        use $crate::Matrix;

        match Matrix::<_>::from_value(($nrows, $ncols), $elem) {
            Err(error) => ::core::panic!("{error}"),
            Ok(matrix) => matrix,
        }
    }};

    [[$($elem:expr),+ $(,)?]; $nrows:expr] => {{
        extern crate alloc;

        use $crate::Matrix;
        use $crate::convert::TryFromRows;

        match <Matrix::<_> as TryFromRows<_>>::try_from_rows(alloc::vec![[$($elem),+]; $nrows]) {
            Err(error) => ::core::panic!("{error}"),
            Ok(matrix) => matrix,
        }
    }};

    [$($row:expr),+ $(,)?] => {{
        use $crate::Matrix;
        use $crate::convert::TryFromRows;

        match <Matrix::<_> as TryFromRows<_>>::try_from_rows([$($row),+]) {
            Err(error) => ::core::panic!("{error}"),
            Ok(matrix) => matrix,
        }
    }};
}