@@ -21,7 +21,7 @@ impl<T> Matrix<T> {
21
21
/// Panics if either `rows` or `cols` are equal to `0`
22
22
///
23
23
/// # Examples
24
- /// ```text
24
+ /// ```rust
25
25
/// let mut mat: Matrix<i32> = Matrix::new(3, 6);
26
26
/// ```
27
27
pub fn new ( rows : usize , cols : usize ) -> Matrix < T >
@@ -41,7 +41,7 @@ impl<T> Matrix<T> {
41
41
/// Panics if the iterator does not have `rows * cols` values
42
42
///
43
43
/// # Examples
44
- /// ```text
44
+ /// ```rust
45
45
/// let mat: Matrix<usize> = Matrix::new(3, 6, 0..);
46
46
///
47
47
/// assert_eq!(mat.get(0, 0).unwrap(), 0);
@@ -65,7 +65,7 @@ impl<T> Matrix<T> {
65
65
/// Returns the number of rows in the matrix.
66
66
///
67
67
/// # Examples
68
- /// ```text
68
+ /// ```rust
69
69
/// let mat: Matrix<usize> = Matrix::new(3, 6, 0..);
70
70
///
71
71
/// assert_eq!(mat.rows(), 3);
@@ -77,7 +77,7 @@ impl<T> Matrix<T> {
77
77
/// Returns the number of columns in the matrix.
78
78
///
79
79
/// # Examples
80
- /// ```text
80
+ /// ```rust
81
81
/// let mat: Matrix<usize> = Matrix::new(3, 6, 0..);
82
82
///
83
83
/// assert_eq!(mat.cols(), 6);
@@ -90,7 +90,7 @@ impl<T> Matrix<T> {
90
90
/// Returns `None` if `row` or `col` is outside of the matrix.
91
91
///
92
92
/// # Examples
93
- /// ```text
93
+ /// ```rust
94
94
/// let mat: Matrix<usize> = Matrix::new(3, 6, 0..);
95
95
///
96
96
/// assert_eq!(mat.get(0, 0).unwrap(), 0);
@@ -110,7 +110,7 @@ impl<T> Matrix<T> {
110
110
/// Returns `None` if `row` or `col` is outside of the matrix.
111
111
///
112
112
/// # Examples
113
- /// ```text
113
+ /// ```rust
114
114
/// let mut mat: Matrix<usize> = Matrix::new(3, 6, 0..);
115
115
/// assert_eq!(mat.get(0, 0).unwrap(), 0);
116
116
///
@@ -132,7 +132,7 @@ impl<T> Matrix<T> {
132
132
/// Returns `true` if the cell has been modified.
133
133
///
134
134
/// # Examples
135
- /// ```text
135
+ /// ```rust
136
136
/// let mut mat: Matrix<usize> = Matrix::new(3, 6, 0..);
137
137
/// assert_eq!(mat.get(0, 0).unwrap(), 0);
138
138
///
@@ -152,7 +152,7 @@ impl<T> Matrix<T> {
152
152
/// Returns `None` if given row is outside of the matrix.
153
153
///
154
154
/// # Examples
155
- /// ```text
155
+ /// ```rust
156
156
/// let mat: Matrix<usize> = Matrix::new(3, 6, 0..);
157
157
///
158
158
/// assert_eq!(mat.get_row(1).unwrap(), vec![6, 7, 8, 9, 10, 11]);
@@ -171,7 +171,7 @@ impl<T> Matrix<T> {
171
171
/// Returns `None` if given row is outside of the matrix.
172
172
///
173
173
/// # Examples
174
- /// ```text
174
+ /// ```rust
175
175
/// let mat: Matrix<usize> = Matrix::new(3, 6, 0..);
176
176
///
177
177
/// assert_eq!(mat.get_col(1).unwrap(), vec![1, 7, 13]);
@@ -189,7 +189,7 @@ impl<T> Matrix<T> {
189
189
/// Take a *M*x*N* Matrix and construct the transposed *N*x*M* Matrix.
190
190
///
191
191
/// # Examples
192
- /// ```text
192
+ /// ```rust
193
193
/// let mat: Matrix<usize> = Matrix::new(3, 6, 0..);
194
194
/// let mat_t = mat.transpose();
195
195
///
@@ -223,7 +223,7 @@ impl<T> Matrix<T> {
223
223
/// if you want to modify the cells, use `apply_mut`.
224
224
///
225
225
/// # Examples
226
- /// ```text
226
+ /// ```rust
227
227
/// // Get the sum of all cells
228
228
/// let mat: Matrix<usize> = Matrix::new(3, 6, 0..);
229
229
/// let mut sum = 0;
@@ -240,7 +240,7 @@ impl<T> Matrix<T> {
240
240
/// and can therefore be modified.
241
241
///
242
242
/// # Examples
243
- /// ```text
243
+ /// ```rust
244
244
/// // Modify all cells with a function
245
245
/// let mut mat: Matrix<usize> = Matrix::new(3, 6, 0..);
246
246
/// mat.apply_mut(|n| n *= 2);
0 commit comments