sharky-arrayvec 0.5.0

An array backed vector
Documentation
use core::ops;

use super::ArrayVec;

impl<const C: usize, T> Default for ArrayVec<C, T> {
    #[inline]
    fn default() -> Self {
        Self::new()
    }
}

impl<const C: usize, T> ops::Index<usize> for ArrayVec<C, T> {
    type Output = T;

    #[inline]
    fn index(&self, index: usize) -> &Self::Output {
        &self.as_slice()[index]
    }
}

impl<const C: usize, T> ops::IndexMut<usize> for ArrayVec<C, T> {
    #[inline]
    fn index_mut(&mut self, index: usize) -> &mut Self::Output {
        &mut self.as_slice_mut()[index]
    }
}

impl<const C: usize, T> ops::Deref for ArrayVec<C, T> {
    type Target = [T];

    #[inline]
    fn deref(&self) -> &Self::Target {
        self.as_slice()
    }
}

impl<const C: usize, T> ops::DerefMut for ArrayVec<C, T> {
    #[inline]
    fn deref_mut(&mut self) -> &mut Self::Target {
        self.as_slice_mut()
    }
}

impl<const C: usize, T: PartialEq> PartialEq for ArrayVec<C, T> {
    #[inline]
    fn eq(&self, other: &ArrayVec<C, T>) -> bool {
        self.len() == other.len() && self.as_slice().eq(other.as_slice())
    }
}

impl<const C: usize, T: Eq> Eq for ArrayVec<C, T> {}

impl<const C: usize, T: PartialOrd> PartialOrd for ArrayVec<C, T> {
    #[inline]
    fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
        self.as_slice().partial_cmp(other.as_slice())
    }
}

impl<const C: usize, T: Ord> Ord for ArrayVec<C, T> {
    #[inline]
    fn cmp(&self, other: &Self) -> core::cmp::Ordering {
        self.as_slice().cmp(other.as_slice())
    }
}

impl<const C: usize, T> ArrayVec<C, T> {}

#[cfg(test)]
#[cfg_attr(coverage_nightly, coverage(off))]
mod tests {}