summaryrefslogtreecommitdiffstats
path: root/vendor/tinyvec/src/array/const_generic_impl.rs
blob: 0b145f168b02748b21333e4fc25dd2cffd43d841 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use super::Array;

impl<T: Default, const N: usize> Array for [T; N] {
  type Item = T;
  const CAPACITY: usize = N;

  #[inline(always)]
  #[must_use]
  fn as_slice(&self) -> &[T] {
    &*self
  }

  #[inline(always)]
  #[must_use]
  fn as_slice_mut(&mut self) -> &mut [T] {
    &mut *self
  }

  #[inline(always)]
  fn default() -> Self {
    [(); N].map(|_| Default::default())
  }
}