ndarray_cg/d2/mat/
general.rs

1
2
3
4
5
6
7
8
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
mod private
{
  // use crate::*;

  // =

  /// A trait indicate that matrix in case of referencing it can be interpreted as such having specified shape `ROWS x COLS`.
  ///
  /// This trait defines a constant `ROWS, COLS`, representing the length of the entity.
  pub trait MatWithShape< const ROWS : usize, const COLS : usize >
  {
  }

  /// Implementation of `MatWithShape` for references to entities.
  impl< T, const ROWS : usize, const COLS : usize > MatWithShape< ROWS, COLS > for &T
  where
    T : MatWithShape< ROWS, COLS >,
  {
  }

  /// Implementation of `MatWithShape` for mutable references to entities.
  impl< T, const ROWS : usize, const COLS : usize > MatWithShape< ROWS, COLS > for &mut T
  where
    T : MatWithShape< ROWS, COLS >,
  {
  }

  // =

  /// A trait indicate that matrix in case of mutable referencing it can be interpreted as such having specified shape `ROWS x COLS`.
  ///
  /// This trait defines a constant `ROWS, COLS`, representing the length of the entity.
  pub trait MatWithShapeMut< const ROWS : usize, const COLS : usize >
  where
    Self : MatWithShape< ROWS, COLS >,
  {
  }

  /// Implementation of `MatWithShapeMut` for references to entities.
  impl< T, const ROWS : usize, const COLS : usize > MatWithShapeMut< ROWS, COLS > for &T
  where
    Self : MatWithShape< ROWS, COLS > + MatWithShapeMut< ROWS, COLS > +,
  {
  }

  /// Implementation of `MatWithShapeMut` for mutable references to entities.
  impl< T, const ROWS : usize, const COLS : usize > MatWithShapeMut< ROWS, COLS > for &mut T
  where
    Self : MatWithShape< ROWS, COLS > + MatWithShapeMut< ROWS, COLS >,
  {
  }

  // =

}

crate::mod_interface!
{

  exposed use
  {
    MatWithShape,
    MatWithShapeMut,
  };

}