use super::Array;
use core::{
slice::{
from_raw_parts as fat,
from_raw_parts_mut as mutfat
},
borrow::{
Borrow,
BorrowMut
},
ops::{
Deref,
DerefMut,
DerefPure
}
};
const impl<Type, const N: usize> Deref for Array<Type, N> {
type Target = [Type];
fn deref(&self) -> &Self::Target {return unsafe {fat(self.as_ptr(), self.length)}}
}
const impl<Type, const N: usize> DerefMut for Array<Type, N> {
fn deref_mut(&mut self) -> &mut Self::Target {return unsafe {mutfat(self.as_mut_ptr(), self.length)}}
}
unsafe impl<Type, const N: usize> DerefPure for Array<Type, N> {}
const impl<Type, const N: usize> AsRef<[Type]> for Array<Type, N> {
fn as_ref(&self) -> &[Type] {return self.deref()}
}
const impl<Type, const N: usize> AsMut<[Type]> for Array<Type, N> {
fn as_mut(&mut self) -> &mut [Type] {return self.deref_mut()}
}
const impl<Type, const N: usize> Borrow<[Type]> for Array<Type, N> {
fn borrow(&self) -> &[Type] {self.as_ref()}
}
const impl<Type, const N: usize> BorrowMut<[Type]> for Array<Type, N> {
fn borrow_mut(&mut self) -> &mut [Type] {self.as_mut()}
}