pub enum Accidental {
Natural,
Sharp,
DoubleSharp,
Flat,
DoubleFlat,
}Expand description
Represents an accidental alteration on a note.
Variants§
Natural
Natural (no accidental). ‘♮’ symbol.
Sharp
Sharp accidental. ‘♯’, ‘#’ symbols.
DoubleSharp
Double sharp accidental. ‘𝄪’, ‘##’ symbols.
Flat
Flat accidental. ‘♭’, ‘b’ symbols.
DoubleFlat
Double flat accidental. ‘𝄫’, ‘bb’ symbols.
Implementations§
Source§impl Accidental
impl Accidental
Sourcepub fn from_str(s: &str) -> Option<Self>
pub fn from_str(s: &str) -> Option<Self>
Tries to parse a string into an accidental. Case insensitive (for both flat alterations).
§Examples
use chord_parser::chord::*;
assert_eq!(Some(Accidental::Flat), Accidental::from_str("B")); // Case insensitive
assert_eq!(Some(Accidental::DoubleFlat), Accidental::from_str("𝄫")); // Unicode works
assert_eq!(None, Accidental::from_str("as")); // Invalid inputTrait Implementations§
Source§impl Clone for Accidental
impl Clone for Accidental
Source§fn clone(&self) -> Accidental
fn clone(&self) -> Accidental
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Accidental
impl Debug for Accidental
Source§impl PartialEq for Accidental
impl PartialEq for Accidental
Source§impl ToString for Accidental
impl ToString for Accidental
impl Eq for Accidental
impl StructuralPartialEq for Accidental
Auto Trait Implementations§
impl Freeze for Accidental
impl RefUnwindSafe for Accidental
impl Send for Accidental
impl Sync for Accidental
impl Unpin for Accidental
impl UnwindSafe for Accidental
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more