Make FixedSizeArray an unsafe trait
This commit is contained in:
parent
72a10fa1d3
commit
85f48d300a
@ -35,14 +35,14 @@ use slice::{Iter, IterMut, SliceExt};
|
||||
///
|
||||
/// This trait can be used to implement other traits on fixed-size arrays
|
||||
/// without causing much metadata bloat.
|
||||
pub trait FixedSizeArray<T> {
|
||||
pub unsafe trait FixedSizeArray<T> {
|
||||
/// Converts the array to immutable slice
|
||||
fn as_slice(&self) -> &[T];
|
||||
/// Converts the array to mutable slice
|
||||
fn as_mut_slice(&mut self) -> &mut [T];
|
||||
}
|
||||
|
||||
impl<T, A: Unsize<[T]>> FixedSizeArray<T> for A {
|
||||
unsafe impl<T, A: Unsize<[T]>> FixedSizeArray<T> for A {
|
||||
#[inline]
|
||||
fn as_slice(&self) -> &[T] {
|
||||
self
|
||||
|
Loading…
Reference in New Issue
Block a user