pub struct GABCParser;
Expand description
Parser that recognizes gabc, generated from gabc.pest
.
§Examples
let pairs = GABCParser::parse(Rule::syllable, "Po(ev/)");
assert!(pairs.is_ok());
//pairs is a Result containing an iterator with a single Pair;
//we unwrap the syllable pair and examine its sub-pairs
let mut pair_iter = pairs.unwrap().next().unwrap().into_inner();
let a = pair_iter.next().unwrap();
assert_eq!(a.as_rule(), Rule::string);
assert_eq!(a.as_str(), "Po");
let b = pair_iter.next().unwrap();
assert_eq!(b.as_rule(), Rule::note);
assert_eq!(b.as_str(), "ev");
let c = pair_iter.next().unwrap();
assert_eq!(c.as_rule(), Rule::spacer);
assert_eq!(c.as_str(), "/");
assert_eq!(pair_iter.next(), None);
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GABCParser
impl RefUnwindSafe for GABCParser
impl Send for GABCParser
impl Sync for GABCParser
impl Unpin for GABCParser
impl UnwindSafe for GABCParser
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more