Struct Note

Source
pub struct Note(/* private fields */);

Implementations§

Source§

impl Note

Source

pub fn base(&self) -> Self

Returns the base note (the one in the C4 octave)

Examples found in repository?
examples/notes.rs (line 6)
3fn main() {
4    let note = A;
5    let i = i8::from(note);
6    let b = note.base();
7    let o = note.octave();
8    println!("A: {i} => {note:?} base={b} octave={o}");
9
10    let note = G_SHARP;
11    let i = i8::from(note);
12    let b = note.base();
13    let o = note.octave();
14    println!("G#: {i} => {note:?} base={b} octave={o}");
15
16    let note = A + SEMI_TONE;
17    let i = i8::from(note);
18    let b = note.base();
19    let o = note.octave();
20    println!("A + H: {i} => {note:?} base={b} octave={o}");
21
22    let note = G_SHARP + SEMI_TONE;
23    let i = i8::from(note);
24    let b = note.base();
25    let o = note.octave();
26    println!("G# + H: {i} => {note:?} base={b} octave={o}");
27
28    let note = A - SEMI_TONE;
29    let i = i8::from(note);
30    let b = note.base();
31    let o = note.octave();
32    println!("A - H: {i} => {note:?} base={b} octave={o}");
33
34    let note = A - SEMI_TONE - OCTAVE;
35    let i = i8::from(note);
36    let b = note.base();
37    let o = note.octave();
38    println!("A - H - O: {i} => {note:?} base={b} octave={o}");
39}
Source

pub fn octave(&self) -> i8

Returns the octave for the given note (eg. C4)

Examples found in repository?
examples/notes.rs (line 7)
3fn main() {
4    let note = A;
5    let i = i8::from(note);
6    let b = note.base();
7    let o = note.octave();
8    println!("A: {i} => {note:?} base={b} octave={o}");
9
10    let note = G_SHARP;
11    let i = i8::from(note);
12    let b = note.base();
13    let o = note.octave();
14    println!("G#: {i} => {note:?} base={b} octave={o}");
15
16    let note = A + SEMI_TONE;
17    let i = i8::from(note);
18    let b = note.base();
19    let o = note.octave();
20    println!("A + H: {i} => {note:?} base={b} octave={o}");
21
22    let note = G_SHARP + SEMI_TONE;
23    let i = i8::from(note);
24    let b = note.base();
25    let o = note.octave();
26    println!("G# + H: {i} => {note:?} base={b} octave={o}");
27
28    let note = A - SEMI_TONE;
29    let i = i8::from(note);
30    let b = note.base();
31    let o = note.octave();
32    println!("A - H: {i} => {note:?} base={b} octave={o}");
33
34    let note = A - SEMI_TONE - OCTAVE;
35    let i = i8::from(note);
36    let b = note.base();
37    let o = note.octave();
38    println!("A - H - O: {i} => {note:?} base={b} octave={o}");
39}
Source

pub fn dim(self) -> Chords

Builds a dim chord with the root in the current note.

Examples found in repository?
examples/exercise4.rs (line 9)
3fn main() {
4    println!();
5    println!("Exercise 4: | C | F | Bdim | Em | Am | Dm | G | C |");
6
7    println!("{:X}", C.maj());
8    println!("{:X}", F.maj());
9    println!("{:X}", B.dim());
10    println!("{:X}", E.min());
11    println!("{:X}", A.min());
12    println!("{:X}", D.min());
13    println!("{:X}", G.maj());
14    println!("{:X}", C.maj());
15}
Source

pub fn dim7(self) -> Chords

Builds a dim7 chord with the root in the current note.

§Example
use musika_rs::*;

let chord = C.dim7();
println!("{:X}", chord);
Source

pub fn dimished_chords(self) -> impl Iterator<Item = Chords>

Return all the diminished chords for the current note.

Source

pub fn dom7(self) -> Chords

Builds a dominant7 choard with the root in the current note.

§Example
use musika_rs::*;

let chord = C.dom7();
println!("{:X}", chord);
Examples found in repository?
examples/chords.rs (line 13)
3fn main() {
4    let chord = C.maj();
5    println!("{chord:X}");
6
7    let chord = C.maj7();
8    println!("{chord:X}");
9
10    let chord = C.min();
11    println!("{chord:X}");
12
13    let chord = C.dom7();
14    println!("{chord:X}");
15}
Source

pub fn dom7b5(self) -> Chords

Source

pub fn dom7s5(self) -> Chords

Source

pub fn dom9(self) -> Chords

Source

pub fn dom11(self) -> Chords

Source

pub fn dom13(self) -> Chords

Examples found in repository?
examples/exercise5.rs (line 6)
3fn key_c_major() {
4    // Bar1
5    let bar1 = Bar::new().with_chord(D.min9(), 2).with_chord(D.min9(), 2);
6    let bar2 = Bar::new().with_chord(G.dom13(), 2).with_chord(G.dom13(), 2);
7
8    let line1 = [&bar1, &bar2, &bar1, &bar2];
9    let s = line1
10        .iter()
11        .map(|b| format!("{}", b))
12        .collect::<Vec<_>>()
13        .as_slice()
14        .join(" | ");
15    println!("| {s} |");
16
17    let bar3 = Bar::new().with_chord(C.maj9(), 2).with_chord(C.maj9(), 2);
18    let bar4 = Bar::new().with_chord(F.maj13(), 2).with_chord(F.maj13(), 2);
19    let bar5 = Bar::new()
20        .with_chord(A.dom13b9b13(), 2)
21        .with_chord(A.dom13b9b13(), 2);
22
23    let line2 = [&bar3, &bar4, &bar3, &bar5];
24    let s = line2
25        .iter()
26        .map(|b| format!("{}", b))
27        .collect::<Vec<_>>()
28        .as_slice()
29        .join(" | ");
30    println!("| {s} |");
31}
32
33fn key_f_major() {
34    // Bar1
35    // D -> G [D, F, G]
36    // G -> C [G, A, B]
37
38    let bar1 = Bar::new().with_chord(G.min9(), 2).with_chord(G.min9(), 2);
39    let bar2 = Bar::new().with_chord(C.dom13(), 2).with_chord(G.dom13(), 2);
40
41    let line1 = [&bar1, &bar2, &bar1, &bar2];
42    let s = line1
43        .iter()
44        .map(|b| format!("{}", b))
45        .collect::<Vec<_>>()
46        .as_slice()
47        .join(" | ");
48    println!("| {s} |");
49
50    // C -> F [C, D, E, F]
51    // F -> Bb
52    let bar3 = Bar::new().with_chord(C.maj9(), 2).with_chord(C.maj9(), 2);
53    let bar4 = Bar::new()
54        .with_chord(A_SHARP.maj13(), 2)
55        .with_chord(A_SHARP.maj13(), 2);
56    // A -> D [A, B, C, D]
57    let bar5 = Bar::new()
58        .with_chord(D.dom13b9b13(), 2)
59        .with_chord(D.dom13b9b13(), 2);
60
61    let line2 = [&bar3, &bar4, &bar3, &bar5];
62    let s = line2
63        .iter()
64        .map(|b| format!("{}", b))
65        .collect::<Vec<_>>()
66        .as_slice()
67        .join(" | ");
68    println!("| {s} |");
69}
Source

pub fn dom13b9b13(self) -> Chords

Examples found in repository?
examples/exercise5.rs (line 20)
3fn key_c_major() {
4    // Bar1
5    let bar1 = Bar::new().with_chord(D.min9(), 2).with_chord(D.min9(), 2);
6    let bar2 = Bar::new().with_chord(G.dom13(), 2).with_chord(G.dom13(), 2);
7
8    let line1 = [&bar1, &bar2, &bar1, &bar2];
9    let s = line1
10        .iter()
11        .map(|b| format!("{}", b))
12        .collect::<Vec<_>>()
13        .as_slice()
14        .join(" | ");
15    println!("| {s} |");
16
17    let bar3 = Bar::new().with_chord(C.maj9(), 2).with_chord(C.maj9(), 2);
18    let bar4 = Bar::new().with_chord(F.maj13(), 2).with_chord(F.maj13(), 2);
19    let bar5 = Bar::new()
20        .with_chord(A.dom13b9b13(), 2)
21        .with_chord(A.dom13b9b13(), 2);
22
23    let line2 = [&bar3, &bar4, &bar3, &bar5];
24    let s = line2
25        .iter()
26        .map(|b| format!("{}", b))
27        .collect::<Vec<_>>()
28        .as_slice()
29        .join(" | ");
30    println!("| {s} |");
31}
32
33fn key_f_major() {
34    // Bar1
35    // D -> G [D, F, G]
36    // G -> C [G, A, B]
37
38    let bar1 = Bar::new().with_chord(G.min9(), 2).with_chord(G.min9(), 2);
39    let bar2 = Bar::new().with_chord(C.dom13(), 2).with_chord(G.dom13(), 2);
40
41    let line1 = [&bar1, &bar2, &bar1, &bar2];
42    let s = line1
43        .iter()
44        .map(|b| format!("{}", b))
45        .collect::<Vec<_>>()
46        .as_slice()
47        .join(" | ");
48    println!("| {s} |");
49
50    // C -> F [C, D, E, F]
51    // F -> Bb
52    let bar3 = Bar::new().with_chord(C.maj9(), 2).with_chord(C.maj9(), 2);
53    let bar4 = Bar::new()
54        .with_chord(A_SHARP.maj13(), 2)
55        .with_chord(A_SHARP.maj13(), 2);
56    // A -> D [A, B, C, D]
57    let bar5 = Bar::new()
58        .with_chord(D.dom13b9b13(), 2)
59        .with_chord(D.dom13b9b13(), 2);
60
61    let line2 = [&bar3, &bar4, &bar3, &bar5];
62    let s = line2
63        .iter()
64        .map(|b| format!("{}", b))
65        .collect::<Vec<_>>()
66        .as_slice()
67        .join(" | ");
68    println!("| {s} |");
69}
Source

pub fn dominant_chords(self) -> impl Iterator<Item = Chords>

Source

pub fn maj(self) -> Chords

Builds a major chord with the root in the current note.

§Example
use musika_rs::*;

let chord = C.maj();
println!("{:X}", chord);
Examples found in repository?
examples/chords.rs (line 4)
3fn main() {
4    let chord = C.maj();
5    println!("{chord:X}");
6
7    let chord = C.maj7();
8    println!("{chord:X}");
9
10    let chord = C.min();
11    println!("{chord:X}");
12
13    let chord = C.dom7();
14    println!("{chord:X}");
15}
More examples
Hide additional examples
examples/exercise1.rs (line 6)
3fn main() {
4    println!();
5    println!("Exercise 1: | C - Am | F - G |");
6    println!("{:X}", C.maj()); // C [C, E, G]
7    println!("{:X}", A.min()); // Am [A, C, E]
8    println!("{:X}", F.maj()); // F [F, A, C]
9    println!("{:X}", G.maj()); // G [G, B, D]
10}
examples/exercise4.rs (line 7)
3fn main() {
4    println!();
5    println!("Exercise 4: | C | F | Bdim | Em | Am | Dm | G | C |");
6
7    println!("{:X}", C.maj());
8    println!("{:X}", F.maj());
9    println!("{:X}", B.dim());
10    println!("{:X}", E.min());
11    println!("{:X}", A.min());
12    println!("{:X}", D.min());
13    println!("{:X}", G.maj());
14    println!("{:X}", C.maj());
15}
examples/exercise2.rs (line 6)
3fn main() {
4    println!();
5    println!("Exercise 2: | C - G | Am - F | C - G | F - Em - Dm - C |");
6    println!("{:X}", C.maj()); // C [C, E, G]
7    println!("{:X}", G.maj()); // G [G, B, D]
8    println!("{:X}", A.min()); // Am [A, C, E]
9    println!("{:X}", F.maj()); // F [F, A, C]
10    println!("{:X}", C.maj()); // C [C, E, G]
11    println!("{:X}", G.maj()); // G [G, B, D]
12    println!("{:X}", F.maj()); // F [F, A, C]
13    println!("{:X}", E.min()); // Em [E, G, B]
14    println!("{:X}", D.min()); // Dm [D, F, A]
15    println!("{:X}", C.maj()); // C [C, E, G]
16}
examples/exercise3.rs (line 7)
3fn main() {
4    println!();
5    println!("Exercise 3: | Cx4 | Gx4 | Gx4 | Cx4 | Fx4 | Cx4 | Gx4 | Cx4 |");
6
7    let cmaj = C.maj();
8    let gmaj = G.maj();
9    let fmaj = F.maj();
10
11    // bar 1
12    for _ in 0..4 {
13        println!("{:X}", cmaj); // C [C, E, G]
14    }
15
16    // bar 2
17    for _ in 0..4 {
18        println!("{:X}", gmaj); // C [C, E, G]
19    }
20
21    // bar 3
22    for _ in 0..4 {
23        println!("{:X}", gmaj); // C [C, E, G]
24    }
25
26    // bar 4
27    for _ in 0..4 {
28        println!("{:X}", cmaj); // C [C, E, G]
29    }
30
31    // bar 5
32    for _ in 0..4 {
33        println!("{:X}", fmaj); // C [C, E, G]
34    }
35
36    // bar 6
37    for _ in 0..4 {
38        println!("{:X}", cmaj); // C [C, E, G]
39    }
40
41    // bar 7
42    for _ in 0..4 {
43        println!("{:X}", gmaj); // C [C, E, G]
44    }
45
46    // bar 8
47    for _ in 0..4 {
48        println!("{:X}", cmaj); // C [C, E, G]
49    }
50}
Source

pub fn maj7(self) -> Chords

Builds a major7 chord with the root in the current note.

§Example
use musika_rs::*;

let chord = C.maj7();
println!("{:X}", chord);
Examples found in repository?
examples/chords.rs (line 7)
3fn main() {
4    let chord = C.maj();
5    println!("{chord:X}");
6
7    let chord = C.maj7();
8    println!("{chord:X}");
9
10    let chord = C.min();
11    println!("{chord:X}");
12
13    let chord = C.dom7();
14    println!("{chord:X}");
15}
Source

pub fn maj9(self) -> Chords

Examples found in repository?
examples/exercise5.rs (line 17)
3fn key_c_major() {
4    // Bar1
5    let bar1 = Bar::new().with_chord(D.min9(), 2).with_chord(D.min9(), 2);
6    let bar2 = Bar::new().with_chord(G.dom13(), 2).with_chord(G.dom13(), 2);
7
8    let line1 = [&bar1, &bar2, &bar1, &bar2];
9    let s = line1
10        .iter()
11        .map(|b| format!("{}", b))
12        .collect::<Vec<_>>()
13        .as_slice()
14        .join(" | ");
15    println!("| {s} |");
16
17    let bar3 = Bar::new().with_chord(C.maj9(), 2).with_chord(C.maj9(), 2);
18    let bar4 = Bar::new().with_chord(F.maj13(), 2).with_chord(F.maj13(), 2);
19    let bar5 = Bar::new()
20        .with_chord(A.dom13b9b13(), 2)
21        .with_chord(A.dom13b9b13(), 2);
22
23    let line2 = [&bar3, &bar4, &bar3, &bar5];
24    let s = line2
25        .iter()
26        .map(|b| format!("{}", b))
27        .collect::<Vec<_>>()
28        .as_slice()
29        .join(" | ");
30    println!("| {s} |");
31}
32
33fn key_f_major() {
34    // Bar1
35    // D -> G [D, F, G]
36    // G -> C [G, A, B]
37
38    let bar1 = Bar::new().with_chord(G.min9(), 2).with_chord(G.min9(), 2);
39    let bar2 = Bar::new().with_chord(C.dom13(), 2).with_chord(G.dom13(), 2);
40
41    let line1 = [&bar1, &bar2, &bar1, &bar2];
42    let s = line1
43        .iter()
44        .map(|b| format!("{}", b))
45        .collect::<Vec<_>>()
46        .as_slice()
47        .join(" | ");
48    println!("| {s} |");
49
50    // C -> F [C, D, E, F]
51    // F -> Bb
52    let bar3 = Bar::new().with_chord(C.maj9(), 2).with_chord(C.maj9(), 2);
53    let bar4 = Bar::new()
54        .with_chord(A_SHARP.maj13(), 2)
55        .with_chord(A_SHARP.maj13(), 2);
56    // A -> D [A, B, C, D]
57    let bar5 = Bar::new()
58        .with_chord(D.dom13b9b13(), 2)
59        .with_chord(D.dom13b9b13(), 2);
60
61    let line2 = [&bar3, &bar4, &bar3, &bar5];
62    let s = line2
63        .iter()
64        .map(|b| format!("{}", b))
65        .collect::<Vec<_>>()
66        .as_slice()
67        .join(" | ");
68    println!("| {s} |");
69}
Source

pub fn maj11(self) -> Chords

Source

pub fn maj13(self) -> Chords

Examples found in repository?
examples/exercise5.rs (line 18)
3fn key_c_major() {
4    // Bar1
5    let bar1 = Bar::new().with_chord(D.min9(), 2).with_chord(D.min9(), 2);
6    let bar2 = Bar::new().with_chord(G.dom13(), 2).with_chord(G.dom13(), 2);
7
8    let line1 = [&bar1, &bar2, &bar1, &bar2];
9    let s = line1
10        .iter()
11        .map(|b| format!("{}", b))
12        .collect::<Vec<_>>()
13        .as_slice()
14        .join(" | ");
15    println!("| {s} |");
16
17    let bar3 = Bar::new().with_chord(C.maj9(), 2).with_chord(C.maj9(), 2);
18    let bar4 = Bar::new().with_chord(F.maj13(), 2).with_chord(F.maj13(), 2);
19    let bar5 = Bar::new()
20        .with_chord(A.dom13b9b13(), 2)
21        .with_chord(A.dom13b9b13(), 2);
22
23    let line2 = [&bar3, &bar4, &bar3, &bar5];
24    let s = line2
25        .iter()
26        .map(|b| format!("{}", b))
27        .collect::<Vec<_>>()
28        .as_slice()
29        .join(" | ");
30    println!("| {s} |");
31}
32
33fn key_f_major() {
34    // Bar1
35    // D -> G [D, F, G]
36    // G -> C [G, A, B]
37
38    let bar1 = Bar::new().with_chord(G.min9(), 2).with_chord(G.min9(), 2);
39    let bar2 = Bar::new().with_chord(C.dom13(), 2).with_chord(G.dom13(), 2);
40
41    let line1 = [&bar1, &bar2, &bar1, &bar2];
42    let s = line1
43        .iter()
44        .map(|b| format!("{}", b))
45        .collect::<Vec<_>>()
46        .as_slice()
47        .join(" | ");
48    println!("| {s} |");
49
50    // C -> F [C, D, E, F]
51    // F -> Bb
52    let bar3 = Bar::new().with_chord(C.maj9(), 2).with_chord(C.maj9(), 2);
53    let bar4 = Bar::new()
54        .with_chord(A_SHARP.maj13(), 2)
55        .with_chord(A_SHARP.maj13(), 2);
56    // A -> D [A, B, C, D]
57    let bar5 = Bar::new()
58        .with_chord(D.dom13b9b13(), 2)
59        .with_chord(D.dom13b9b13(), 2);
60
61    let line2 = [&bar3, &bar4, &bar3, &bar5];
62    let s = line2
63        .iter()
64        .map(|b| format!("{}", b))
65        .collect::<Vec<_>>()
66        .as_slice()
67        .join(" | ");
68    println!("| {s} |");
69}
Source

pub fn major_chords(self) -> impl Iterator<Item = Chords>

Source

pub fn min(self) -> Chords

Builds a minor chord with the root in the current note.

§Example
use musika_rs::*;

let chord = C.min();
println!("{:X}", chord);
Examples found in repository?
examples/chords.rs (line 10)
3fn main() {
4    let chord = C.maj();
5    println!("{chord:X}");
6
7    let chord = C.maj7();
8    println!("{chord:X}");
9
10    let chord = C.min();
11    println!("{chord:X}");
12
13    let chord = C.dom7();
14    println!("{chord:X}");
15}
More examples
Hide additional examples
examples/exercise1.rs (line 7)
3fn main() {
4    println!();
5    println!("Exercise 1: | C - Am | F - G |");
6    println!("{:X}", C.maj()); // C [C, E, G]
7    println!("{:X}", A.min()); // Am [A, C, E]
8    println!("{:X}", F.maj()); // F [F, A, C]
9    println!("{:X}", G.maj()); // G [G, B, D]
10}
examples/exercise4.rs (line 10)
3fn main() {
4    println!();
5    println!("Exercise 4: | C | F | Bdim | Em | Am | Dm | G | C |");
6
7    println!("{:X}", C.maj());
8    println!("{:X}", F.maj());
9    println!("{:X}", B.dim());
10    println!("{:X}", E.min());
11    println!("{:X}", A.min());
12    println!("{:X}", D.min());
13    println!("{:X}", G.maj());
14    println!("{:X}", C.maj());
15}
examples/exercise2.rs (line 8)
3fn main() {
4    println!();
5    println!("Exercise 2: | C - G | Am - F | C - G | F - Em - Dm - C |");
6    println!("{:X}", C.maj()); // C [C, E, G]
7    println!("{:X}", G.maj()); // G [G, B, D]
8    println!("{:X}", A.min()); // Am [A, C, E]
9    println!("{:X}", F.maj()); // F [F, A, C]
10    println!("{:X}", C.maj()); // C [C, E, G]
11    println!("{:X}", G.maj()); // G [G, B, D]
12    println!("{:X}", F.maj()); // F [F, A, C]
13    println!("{:X}", E.min()); // Em [E, G, B]
14    println!("{:X}", D.min()); // Dm [D, F, A]
15    println!("{:X}", C.maj()); // C [C, E, G]
16}
Source

pub fn min7(self) -> Chords

Builds a minor7 chord with the root in the current note.

§Example
use musika_rs::*;

let chord = C.min7();
println!("{:X}", chord);
Source

pub fn min7b5(self) -> Chords

Source

pub fn min9(self) -> Chords

Examples found in repository?
examples/exercise5.rs (line 5)
3fn key_c_major() {
4    // Bar1
5    let bar1 = Bar::new().with_chord(D.min9(), 2).with_chord(D.min9(), 2);
6    let bar2 = Bar::new().with_chord(G.dom13(), 2).with_chord(G.dom13(), 2);
7
8    let line1 = [&bar1, &bar2, &bar1, &bar2];
9    let s = line1
10        .iter()
11        .map(|b| format!("{}", b))
12        .collect::<Vec<_>>()
13        .as_slice()
14        .join(" | ");
15    println!("| {s} |");
16
17    let bar3 = Bar::new().with_chord(C.maj9(), 2).with_chord(C.maj9(), 2);
18    let bar4 = Bar::new().with_chord(F.maj13(), 2).with_chord(F.maj13(), 2);
19    let bar5 = Bar::new()
20        .with_chord(A.dom13b9b13(), 2)
21        .with_chord(A.dom13b9b13(), 2);
22
23    let line2 = [&bar3, &bar4, &bar3, &bar5];
24    let s = line2
25        .iter()
26        .map(|b| format!("{}", b))
27        .collect::<Vec<_>>()
28        .as_slice()
29        .join(" | ");
30    println!("| {s} |");
31}
32
33fn key_f_major() {
34    // Bar1
35    // D -> G [D, F, G]
36    // G -> C [G, A, B]
37
38    let bar1 = Bar::new().with_chord(G.min9(), 2).with_chord(G.min9(), 2);
39    let bar2 = Bar::new().with_chord(C.dom13(), 2).with_chord(G.dom13(), 2);
40
41    let line1 = [&bar1, &bar2, &bar1, &bar2];
42    let s = line1
43        .iter()
44        .map(|b| format!("{}", b))
45        .collect::<Vec<_>>()
46        .as_slice()
47        .join(" | ");
48    println!("| {s} |");
49
50    // C -> F [C, D, E, F]
51    // F -> Bb
52    let bar3 = Bar::new().with_chord(C.maj9(), 2).with_chord(C.maj9(), 2);
53    let bar4 = Bar::new()
54        .with_chord(A_SHARP.maj13(), 2)
55        .with_chord(A_SHARP.maj13(), 2);
56    // A -> D [A, B, C, D]
57    let bar5 = Bar::new()
58        .with_chord(D.dom13b9b13(), 2)
59        .with_chord(D.dom13b9b13(), 2);
60
61    let line2 = [&bar3, &bar4, &bar3, &bar5];
62    let s = line2
63        .iter()
64        .map(|b| format!("{}", b))
65        .collect::<Vec<_>>()
66        .as_slice()
67        .join(" | ");
68    println!("| {s} |");
69}
Source

pub fn min11(self) -> Chords

Source

pub fn min13(self) -> Chords

Source

pub fn minor_chords(self) -> impl Iterator<Item = Chords>

Source

pub fn all_chords(self) -> impl Iterator<Item = Chords>

Examples found in repository?
examples/all.rs (line 5)
3fn main() {
4    let root = C;
5    for c in root.all_chords() {
6        println!("{c:X}")
7    }
8}

Trait Implementations§

Source§

impl Add<Tone> for Note

Source§

type Output = Note

The resulting type after applying the + operator.
Source§

fn add(self, tone: Tone) -> Self::Output

Performs the + operation. Read more
Source§

impl AsRef<i8> for Note

Source§

fn as_ref(&self) -> &i8

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for Note

Source§

fn clone(&self) -> Note

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Note

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Note

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<Note> for i8

Source§

fn from(note: Note) -> Self

Converts to this type from the input type.
Source§

impl From<i8> for Note

Source§

fn from(value: i8) -> Self

Converts to this type from the input type.
Source§

impl LowerHex for Note

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Ord for Note

Source§

fn cmp(&self, other: &Note) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Note

Source§

fn eq(&self, other: &Note) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Note

Source§

fn partial_cmp(&self, other: &Note) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Sub<Tone> for Note

Source§

type Output = Note

The resulting type after applying the - operator.
Source§

fn sub(self, tone: Tone) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub for Note

Source§

type Output = Tone

The resulting type after applying the - operator.
Source§

fn sub(self, other: Note) -> Self::Output

Performs the - operation. Read more
Source§

impl UpperHex for Note

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for Note

Source§

impl Eq for Note

Source§

impl StructuralPartialEq for Note

Auto Trait Implementations§

§

impl Freeze for Note

§

impl RefUnwindSafe for Note

§

impl Send for Note

§

impl Sync for Note

§

impl Unpin for Note

§

impl UnwindSafe for Note

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.