Make FixedSizeArray an unsafe trait

This commit is contained in:
Amit Aryeh Levy 2015-09-19 15:33:34 -04:00
parent 72a10fa1d3
commit 85f48d300a

View File

@ -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