Enum musical_note::NoteName
source · pub enum NoteName {
C,
D,
E,
F,
G,
A,
B,
}Variants§
Implementations§
source§impl NoteName
impl NoteName
sourcepub fn from_str(name: &str) -> Option<Self>
pub fn from_str(name: &str) -> Option<Self>
Examples found in repository?
src/lib.rs (line 414)
412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427
fn note_from_str(name: &str) -> Option<(NoteName, Accidental)> {
let note = &name[0..1];
match NoteName::from_str(note) {
Some(note) => {
if name.len() <= 1 {
return Some((note, Accidental::White));
} else {
match Accidental::from_str(&name[1..]) {
Some(acc) => Some((note, acc)),
None => None,
}
}
}
None => None,
}
}Trait Implementations§
source§impl<'de> Deserialize<'de> for NoteName
impl<'de> Deserialize<'de> for NoteName
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq<NoteName> for NoteName
impl PartialEq<NoteName> for NoteName
source§impl PartialOrd<NoteName> for NoteName
impl PartialOrd<NoteName> for NoteName
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read more