use core::mem::{self, MaybeUninit};
use crate::place::{PlaceRef, PlaceState};
impl<'a, T, const N: usize, S: PlaceState> PlaceRef<'a, [T; N], S> {
#[inline]
#[must_use]
pub const fn len(&self) -> usize {
N
}
#[inline]
#[must_use]
pub const fn is_empty(&self) -> bool {
N == 0
}
#[inline]
#[must_use]
pub const fn to_slice(self) -> PlaceRef<'a, [T], S> {
self
}
#[inline]
#[must_use]
pub const fn to_each(self) -> [PlaceRef<'a, T, S>; N] {
let inner = self.inner.cast::<T>();
mem::forget(self);
let mut ret: [MaybeUninit<PlaceRef<'a, T, S>>; N] = [const { MaybeUninit::uninit() }; N];
let mut i = 0;
while i < N {
ret[i].write(unsafe { PlaceRef::from_inner(inner.add(i)) });
i += 1;
}
unsafe { mem::transmute_copy(&ret) }
}
}
type _Fwd = ();