parent
bba1993e58
commit
098d91cae0
|
@ -68,7 +68,7 @@ pub type MatrixCross<N, R1, C1, R2, C2> =
|
|||
/// dynamically-sized column vector should be represented as a `Matrix<N, Dynamic, U1, S>` (given
|
||||
/// some concrete types for `N` and a compatible data storage type `S`).
|
||||
#[repr(C)]
|
||||
#[derive(Hash, Debug, Clone, Copy)]
|
||||
#[derive(Hash, Clone, Copy)]
|
||||
pub struct Matrix<N: Scalar, R: Dim, C: Dim, S> {
|
||||
/// The data storage that contains all the matrix components and informations about its number
|
||||
/// of rows and column (if needed).
|
||||
|
@ -77,6 +77,14 @@ pub struct Matrix<N: Scalar, R: Dim, C: Dim, S> {
|
|||
_phantoms: PhantomData<(N, R, C)>
|
||||
}
|
||||
|
||||
impl<N: Scalar, R: Dim, C: Dim, S: fmt::Debug> fmt::Debug for Matrix<N, R, C, S> {
|
||||
fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
formatter.debug_struct("Matrix")
|
||||
.field("data", &self.data)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "serde-serialize")]
|
||||
impl<N, R, C, S> Serialize for Matrix<N, R, C, S>
|
||||
where N: Scalar,
|
||||
|
|
|
@ -62,6 +62,13 @@ fn iter() {
|
|||
assert!(it.next().is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn debug_output_corresponds_to_data_container() {
|
||||
assert_eq!(
|
||||
format!("{:?}", Matrix2::new(1.0, 2.0, 3.0, 4.0)),
|
||||
"Matrix { data: [1, 3, 2, 4] }"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn is_column_major() {
|
||||
|
|
Loading…
Reference in New Issue