rstmt_core/notes/impls/
impl_note_repr.rs

1/*
2    Appellation: impl_note_repr <module>
3    Created At: 2026.01.20:08:59:53
4    Contrib: @FL03
5*/
6use crate::notes::note_base::NoteBase;
7use crate::octave::Octave;
8use crate::pitch::{Flat, Natural, PitchClass, RawPitchClass, Sharp};
9
10impl<P> NoteBase<P>
11where
12    P: RawPitchClass,
13{
14    /// returns a new natural note of the given class and octave
15    pub fn natural(class: P, octave: Octave) -> NoteBase<P, Natural>
16    where
17        P: RawPitchClass<Tag = Natural>,
18    {
19        NoteBase::new(PitchClass::natural(class), octave)
20    }
21    /// returns a new sharp note of the given class and octave
22    pub fn sharp(class: P, octave: Octave) -> NoteBase<P, Sharp>
23    where
24        P: RawPitchClass<Tag = Sharp>,
25    {
26        NoteBase::new(PitchClass::sharp(class), octave)
27    }
28    /// returns a new flat note of the given class and octave
29    pub fn flat(class: P, octave: Octave) -> NoteBase<P, Flat>
30    where
31        P: RawPitchClass<Tag = Flat>,
32    {
33        NoteBase::new(PitchClass::flat(class), octave)
34    }
35}