Skip to content

Commit

Permalink
Add Mat_::at_row()
Browse files Browse the repository at this point in the history
  • Loading branch information
twistedfall committed Jul 22, 2024
1 parent 6ed87f0 commit 103b02d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/manual/core/mat/mat_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ impl<T: DataType> Mat_<T> {
self.at_2d(pt.y, pt.x)
}

/// See [Mat::at_row]
#[inline]
pub fn at_row(&self, row: i32) -> Result<&[T]> {
match_indices(self, &[row, 0]).and_then(|_| unsafe { self.at_row_unchecked(row) })
}

/// See [Mat::at_mut]
#[inline]
pub fn at_mut(&mut self, i0: i32) -> Result<&mut T> {
Expand Down Expand Up @@ -129,6 +135,13 @@ impl<T: DataType> Mat_<T> {
self.at_2d_mut(pt.y, pt.x)
}

/// See [Mat::at_row_mut]
#[inline]
pub fn at_row_mut(&mut self, row: i32) -> Result<&mut [T]> {
match_indices(self, &[row, 0])?;
unsafe { self.at_row_unchecked_mut(row) }
}

/// See [Mat::data_typed]
#[inline]
pub fn data_typed(&self) -> Result<&[T]> {
Expand Down

0 comments on commit 103b02d

Please sign in to comment.