eryon_nrt/traits/
convert.rs1use crate::types::{Note, Octave};
6
7pub trait AsNote {
8 fn as_note(&self) -> Note;
9}
10
11pub trait IntoNote {
12 fn into_note(self) -> Note;
13}
14
15pub trait AsOctave {
17 fn as_octave(&self) -> Octave;
18}
19
20pub trait IntoOctave {
22 fn into_octave(self) -> Octave;
23}
24
25impl<T> IntoOctave for T
29where
30 T: Into<Octave>,
31{
32 fn into_octave(self) -> Octave {
33 self.into()
34 }
35}
36
37impl<T> IntoNote for T
38where
39 T: Into<Note>,
40{
41 fn into_note(self) -> Note {
42 self.into()
43 }
44}
45
46impl<T> AsOctave for T
47where
48 T: Clone + IntoOctave,
49{
50 fn as_octave(&self) -> Octave {
51 self.clone().into_octave()
52 }
53}