pub unsafe trait DenseData {
type Elem;
// Required method
fn as_slice(&self) -> &[Self::Elem];
}Expand description
Various view types (types such as MatrixView that add semantic meaning to blobs
of data) need both immutable and mutable variants.
This trait can be implemented by wrappers for immutable and mutable slice references, allowing for a common code path for immutable and mutable view types.
The main goal is to provide a way of retrieving an underlying dense slice, which can then be used as the building block for higher level abstractions.
§Safety
This trait is unsafe because it requires as_slice to be idempotent (and unsafe code
relies on this).
In other words: as_slice must always return the same slice with the same length.