Skip to main content

rstmt_core/chords/
chord_base.rs

1/*
2    Appellation: chord_base <module>
3    Created At: 2026.01.20:08:24:06
4    Contrib: @FL03
5*/
6use super::RawChord;
7
8pub type ChordSlice<T> = ChordBase<[T], T>;
9
10pub type ChordArray<T, const N: usize> = ChordBase<[T; N], T>;
11
12pub type ChordSliceRef<'a, T> = ChordBase<&'a [T], T>;
13
14pub type ChordSliceMut<'a, T> = ChordBase<&'a mut [T], T>;
15
16#[cfg(feature = "alloc")]
17/// a type alias for a [`ChordBase`] that leverages a [`Vec`](alloc::vec::Vec) as its underlying
18/// representation.
19pub type Chord<T> = ChordBase<alloc::vec::Vec<T>, T>;
20
21/// The [`ChordBase`] implementation is designed to be a generic container allowing
22#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
23#[cfg_attr(
24    feature = "serde",
25    derive(serde::Deserialize, serde::Serialize),
26    serde(deny_unknown_fields, rename_all = "snake_case")
27)]
28#[repr(C)]
29pub struct ChordBase<R, T = <R as RawChord>::Elem>
30where
31    R: ?Sized + RawChord<Elem = T>,
32{
33    pub(crate) repr: R,
34}