summaryrefslogtreecommitdiff
path: root/vendor/tinyvec/src/array/generic_array_impl.rs
blob: 29dbd858c33ccaefdc40d8b523bb4a15518eacd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use core::default;

use super::Array;
use generic_array::{ArrayLength, GenericArray};

impl<T: Default, N: ArrayLength> Array for GenericArray<T, N> {
  type Item = T;
  const CAPACITY: usize = N::USIZE;

  #[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 {
    <Self as Default>::default()
  }
}