rstmt_core/pitch/traits/
classifiers.rs1use crate::pitch::RawAccidental;
7use rstmt_traits::PitchMod;
8
9pub trait RawPitchClass
11where
12 Self: Send
13 + Sync
14 + AsRef<str>
15 + AsRef<isize>
16 + PartialEq<isize>
17 + PartialEq<str>
18 + core::borrow::Borrow<isize>
19 + core::fmt::Debug
20 + core::fmt::Display,
21{
22 type Tag: RawAccidental;
23
24 private! {}
25
26 fn new() -> Self
27 where
28 Self: Sized;
29 fn name(&self) -> &str;
31 fn index(&self) -> isize;
33}
34
35pub trait PitchClassRepr: RawPitchClass
38where
39 Self: Default + core::str::FromStr<Err = crate::error::Error> + TryFrom<isize>,
40{
41 const IDX: isize;
42
43 fn is(value: isize) -> bool
45 where
46 Self: Sized,
47 {
48 value.pmod() == Self::IDX
49 }
50}