Struct chord_parser::ChordParser
source · pub struct ChordParser { /* private fields */ }Expand description
The chord parser used for parsing chord signatures into abstract representations defined in chord module
Implementations§
source§impl ChordParser
impl ChordParser
sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new instance of ChordParser.
Use ChordParser::parse(&str) to execute parsing on an input.
sourcepub fn from_str(s: &str) -> ChordParseResult
pub fn from_str(s: &str) -> ChordParseResult
Parse a chord signature directly from the input.
Shorter than having to create an instance via new function.
Examples
use chord_parser::*;
let result = ChordParser::from_str("C#7b9"); // Parse directly from the input
match result {
ChordParseResult::Success(chord) => (),
ChordParseResult::Failure(error_kind) => (),
}sourcepub fn parse(&mut self, s: &str) -> ChordParseResult
pub fn parse(&mut self, s: &str) -> ChordParseResult
Parse a chord signature from a string slice.
Examples
use chord_parser::*;
let mut parser = ChordParser::new();
let result = parser.parse("C#7b9"); // Parse from the input
match result {
ChordParseResult::Success(chord) => (),
ChordParseResult::Failure(error_kind) => (),
}Auto Trait Implementations§
impl RefUnwindSafe for ChordParser
impl Send for ChordParser
impl Sync for ChordParser
impl Unpin for ChordParser
impl UnwindSafe for ChordParser
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