pub struct Syllable<'a> {
pub text: &'a str,
pub music: Vec<NoteElem<'a>>,
}
Expand description
Struct representing a gabc syllable with text and music, e.g. “Po(eh/hi)”
Fields§
§text: &'a str
Text part of the syllable
music: Vec<NoteElem<'a>>
Music part of the syllable
Implementations§
Source§impl<'a> Syllable<'a>
impl<'a> Syllable<'a>
Sourcepub fn new<'b>(gabc_input: &'b str, current_clef: &'b str) -> Syllable<'b>
pub fn new<'b>(gabc_input: &'b str, current_clef: &'b str) -> Syllable<'b>
Create a new syllable from well-formed gabc input.
§Examples
let s = Syllable::new("Po(eh/hi)", "c3");
assert_eq!(s.text, "Po");
assert_eq!(s.music.len(), 5);
Sourcepub fn ly_notes(&self) -> String
pub fn ly_notes(&self) -> String
Translate this syllable’s music string into a tied sequence of Lilypond notes.
§Examples
let s = Syllable::new("Po(eh/hi)", "c3");
assert_eq!(s.ly_notes(), "g(c' c' d')");
Sourcepub fn ly_text(&self) -> String
pub fn ly_text(&self) -> String
Translate this syllable’s text into valid Lilypond lyrics. If there are no Notes in this syllable’s music string, add “\set stanza = “ to prevent Lilypond matching this text to a note.
§Examples
let s = Syllable::new("*()", "c3");
assert_eq!(s.ly_text(), " \\set stanza = \"*\" ");
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Syllable<'a>
impl<'a> RefUnwindSafe for Syllable<'a>
impl<'a> Send for Syllable<'a>
impl<'a> Sync for Syllable<'a>
impl<'a> Unpin for Syllable<'a>
impl<'a> UnwindSafe for Syllable<'a>
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