Skip to main content

SegmentTranscriber

Struct SegmentTranscriber 

Source
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

Source

pub fn new(text: BrailleText) -> Self

A transcriber writing into a text, with nothing to write yet.

Source

pub fn text(&self) -> &BrailleText

The text written so far.

Source

pub fn text_mut(&mut self) -> &mut BrailleText

The text, to write into directly.

Source

pub fn into_text(self) -> BrailleText

The text, once the writing is done.

Source

pub fn keys_mut(&mut self) -> &mut VecDeque<SegmentKey>

The keys still to write: music21’s groupingKeysToProcess.

Source

pub fn current(&self) -> Option<SegmentKey>

The grouping being written: music21’s currentGroupingKey.

Source

pub fn set_current(&mut self, key: Option<SegmentKey>)

Sets the grouping being written.

Source

pub fn previous(&self) -> Option<SegmentKey>

The grouping written before it: music21’s previousGroupingKey.

Source

pub fn set_previous(&mut self, key: Option<SegmentKey>)

Sets the grouping written before.

Source

pub fn last_note(&self) -> Option<&Pitch>

The pitch of the last note written: music21’s lastNote.

Source

pub fn set_last_note(&mut self, pitch: Option<Pitch>)

Sets the last note written.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn needs_split_for(&mut self, cells: usize) -> bool

The same for something so many cells long.

Source

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.

Source

pub fn add_repeat_symbols(&mut self, times: usize) -> Result<()>

The signs for a grouping repeated so many times: music21’s addRepeatSymbols.

§Errors

Signs too wide for a line.

Trait Implementations§

Source§

impl Clone for SegmentTranscriber

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SegmentTranscriber

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.