pub struct SegmentTranscriber { /* private fields */ }Expand description
A segment written into a text a step at a time, with what music21’s segment keeps while it writes: the keys still to write, the grouping being written and the one before it, and the last note written.
BrailleSegment::transcribe is SegmentTranscriber::transcribe
into a fresh text; each other step is one of music21’s extract*
methods, which its own examples call one at a time.
Implementations§
Source§impl SegmentTranscriber
impl SegmentTranscriber
Sourcepub fn new(text: BrailleText) -> Self
pub fn new(text: BrailleText) -> Self
A transcriber writing into a text, with nothing to write yet.
Sourcepub fn text(&self) -> &BrailleText
pub fn text(&self) -> &BrailleText
The text written so far.
Sourcepub fn text_mut(&mut self) -> &mut BrailleText
pub fn text_mut(&mut self) -> &mut BrailleText
The text, to write into directly.
Sourcepub fn into_text(self) -> BrailleText
pub fn into_text(self) -> BrailleText
The text, once the writing is done.
Sourcepub fn keys_mut(&mut self) -> &mut VecDeque<SegmentKey>
pub fn keys_mut(&mut self) -> &mut VecDeque<SegmentKey>
The keys still to write: music21’s groupingKeysToProcess.
Sourcepub fn current(&self) -> Option<SegmentKey>
pub fn current(&self) -> Option<SegmentKey>
The grouping being written: music21’s currentGroupingKey.
Sourcepub fn set_current(&mut self, key: Option<SegmentKey>)
pub fn set_current(&mut self, key: Option<SegmentKey>)
Sets the grouping being written.
Sourcepub fn previous(&self) -> Option<SegmentKey>
pub fn previous(&self) -> Option<SegmentKey>
The grouping written before it: music21’s previousGroupingKey.
Sourcepub fn set_previous(&mut self, key: Option<SegmentKey>)
pub fn set_previous(&mut self, key: Option<SegmentKey>)
Sets the grouping written before.
Sourcepub fn last_note(&self) -> Option<&Pitch>
pub fn last_note(&self) -> Option<&Pitch>
The pitch of the last note written: music21’s lastNote.
Sourcepub fn set_last_note(&mut self, pitch: Option<Pitch>)
pub fn set_last_note(&mut self, pitch: Option<Pitch>)
Sets the last note written.
Sourcepub fn transcribe(&mut self, segment: &mut BrailleSegment) -> Result<()>
pub fn transcribe(&mut self, segment: &mut BrailleSegment) -> Result<()>
The whole segment: its heading and first measure number, then each
grouping in turn: music21’s transcribe.
§Errors
Something too wide for a line, or that music21 cannot write.
Sourcepub fn extract_heading(&mut self, segment: &mut BrailleSegment) -> Result<()>
pub fn extract_heading(&mut self, segment: &mut BrailleSegment) -> Result<()>
The heading out of the signatures, tempo and metronome mark the
segment starts with: music21’s extractHeading.
§Errors
A heading too wide for a line.
Sourcepub fn extract_measure_number(&mut self, segment: &BrailleSegment) -> Result<()>
pub fn extract_measure_number(&mut self, segment: &BrailleSegment) -> Result<()>
The number of the first measure still to write: music21’s
extractMeasureNumber.
§Errors
A number too wide for a line.
Sourcepub fn add_dummy_rests(&mut self, segment: &BrailleSegment) -> Result<()>
pub fn add_dummy_rests(&mut self, segment: &BrailleSegment) -> Result<()>
As many dummy rests as the segment asks for: music21’s
addDummyRests.
§Errors
Rests too many for a line.
Sourcepub fn extract_note_grouping(
&mut self,
segment: &mut BrailleSegment,
) -> Result<()>
pub fn extract_note_grouping( &mut self, segment: &mut BrailleSegment, ) -> Result<()>
The grouping being written, a group of notes: music21’s
extractNoteGrouping.
§Errors
No grouping being written, or one too wide for a line.
Sourcepub fn extract_signature_grouping(
&mut self,
segment: &mut BrailleSegment,
) -> Result<()>
pub fn extract_signature_grouping( &mut self, segment: &mut BrailleSegment, ) -> Result<()>
The grouping being written, signatures: music21’s
extractSignatureGrouping.
§Errors
No grouping being written, or signatures too wide for a line.
Sourcepub fn extract_long_expression_grouping(
&mut self,
segment: &mut BrailleSegment,
) -> Result<()>
pub fn extract_long_expression_grouping( &mut self, segment: &mut BrailleSegment, ) -> Result<()>
The grouping being written, a long text: music21’s
extractLongExpressionGrouping.
§Errors
No grouping being written.
Sourcepub fn extract_inaccord_grouping(
&mut self,
segment: &mut BrailleSegment,
) -> Result<()>
pub fn extract_inaccord_grouping( &mut self, segment: &mut BrailleSegment, ) -> Result<()>
The grouping being written, voices in accord: music21’s
extractInaccordGrouping.
§Errors
No grouping being written, or a voice too wide for a line.
Sourcepub fn extract_tempo_text_grouping(
&mut self,
segment: &mut BrailleSegment,
) -> Result<()>
pub fn extract_tempo_text_grouping( &mut self, segment: &mut BrailleSegment, ) -> Result<()>
The grouping being written, tempo words, which start a heading of
their own: music21’s extractTempoTextGrouping.
§Errors
No grouping being written or none before it.
Sourcepub fn show_leading_octave_from(
&mut self,
grouping: &BrailleElementGrouping,
suppress_octave_marks: bool,
) -> bool
pub fn show_leading_octave_from( &mut self, grouping: &BrailleElementGrouping, suppress_octave_marks: bool, ) -> bool
Whether a grouping written next shows its first note’s octave:
music21’s showLeadingOctaveFromNoteGrouping.
Sourcepub fn needs_split_to_fit(&mut self, braille: &str) -> bool
pub fn needs_split_to_fit(&mut self, braille: &str) -> bool
Whether braille this long has to be split to fit what is left of
the line: music21’s needsSplitToFit.
Sourcepub fn needs_split_for(&mut self, cells: usize) -> bool
pub fn needs_split_for(&mut self, cells: usize) -> bool
The same for something so many cells long.
Sourcepub fn split_and_transcribe(
&mut self,
segment: &mut BrailleSegment,
show_leading_octave_on_first: bool,
add_space_to_first: bool,
) -> Result<Option<(String, String)>>
pub fn split_and_transcribe( &mut self, segment: &mut BrailleSegment, show_leading_octave_on_first: bool, add_space_to_first: bool, ) -> Result<Option<(String, String)>>
The grouping being written split where the line has room, each half
written and kept in the segment under its own key: music21’s
splitNoteGroupingAndTranscribe. Nothing where no split fits.
§Errors
No grouping being written, or a meter that cannot be halved.
Trait Implementations§
Source§impl Clone for SegmentTranscriber
impl Clone for SegmentTranscriber
Auto Trait Implementations§
impl Forget for SegmentTranscriber
impl Freeze for SegmentTranscriber
impl RefUnwindSafe for SegmentTranscriber
impl Send for SegmentTranscriber
impl Sync for SegmentTranscriber
impl Unpin for SegmentTranscriber
impl UnsafeUnpin for SegmentTranscriber
impl UnwindSafe for SegmentTranscriber
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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> ⓘ
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