Skip to content

Commit

Permalink
feat: implement AsRef<[T]> for matrices with a contiguous storage
Browse files Browse the repository at this point in the history
  • Loading branch information
sebcrozet committed Oct 16, 2024
1 parent cff4b99 commit 33d5db4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/base/matrix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1341,6 +1341,14 @@ impl<T, R: Dim, C: Dim, S: RawStorage<T, R, C> + IsContiguous> Matrix<T, R, C, S
}
}

impl<T, R: Dim, C: Dim, S: RawStorage<T, R, C> + IsContiguous> AsRef<[T]> for Matrix<T, R, C, S> {
/// Extracts a slice containing the entire matrix entries ordered column-by-columns.
#[inline]
fn as_ref(&self) -> &[T] {
self.as_slice()
}
}

impl<T, R: Dim, C: Dim, S: RawStorageMut<T, R, C> + IsContiguous> Matrix<T, R, C, S> {
/// Extracts a mutable slice containing the entire matrix entries ordered column-by-columns.
#[inline]
Expand Down

0 comments on commit 33d5db4

Please sign in to comment.