Skip to content

Commit eb19dd1

Browse files
committed
Add Mat_::at_row()
1 parent f4f3b6a commit eb19dd1

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/manual/core/mat/mat_.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ impl<T: DataType> Mat_<T> {
9595
self.at_2d(pt.y, pt.x)
9696
}
9797

98+
/// See [Mat::at_row]
99+
#[inline]
100+
pub fn at_row(&self, row: i32) -> Result<&[T]> {
101+
match_indices(self, &[row, 0]).and_then(|_| unsafe { self.at_row_unchecked(row) })
102+
}
103+
98104
/// See [Mat::at_mut]
99105
#[inline]
100106
pub fn at_mut(&mut self, i0: i32) -> Result<&mut T> {
@@ -129,6 +135,13 @@ impl<T: DataType> Mat_<T> {
129135
self.at_2d_mut(pt.y, pt.x)
130136
}
131137

138+
/// See [Mat::at_row_mut]
139+
#[inline]
140+
pub fn at_row_mut(&mut self, row: i32) -> Result<&mut [T]> {
141+
match_indices(self, &[row, 0])?;
142+
unsafe { self.at_row_unchecked_mut(row) }
143+
}
144+
132145
/// See [Mat::data_typed]
133146
#[inline]
134147
pub fn data_typed(&self) -> Result<&[T]> {

0 commit comments

Comments
 (0)