Skip to main content

BrailleText

Struct BrailleText 

Source
pub struct BrailleText {
    pub line_length: usize,
    pub all_lines: Vec<BrailleTextLine>,
    pub right_hand_symbol: bool,
    pub left_hand_symbol: bool,
    pub all_headings: Vec<(usize, usize)>,
}
Expand description

Braille laid out in lines, with headings, measure numbers and the signs of a hand at the keyboard: music21’s BrailleText.

Fields§

§line_length: usize

How many cells a line holds.

§all_lines: Vec<BrailleTextLine>

Every line.

§right_hand_symbol: bool

Whether lines of notes start with the right hand’s sign.

§left_hand_symbol: bool

Whether lines of notes start with the left hand’s sign.

§all_headings: Vec<(usize, usize)>

Where each heading’s lines start and end.

Implementations§

Source§

impl BrailleText

Source

pub fn new(line_length: usize, show_hand: Option<&str>) -> Result<Self>

Text of lines this long, with a hand’s sign where asked: right or left.

§Errors

A hand music21 does not know.

Source

pub fn set_show_hand(&mut self, hand: Option<&str>) -> Result<()>

Which hand’s sign the notes’ lines start with: music21’s showHand setter. music21’s getter never answers what was set.

§Errors

A hand music21 does not know.

Source

pub fn current_line(&mut self) -> &mut BrailleTextLine

The line being written.

Source

pub fn make_new_line(&mut self)

Starts a new line: music21’s makeNewLine.

Source

pub fn add_heading(&mut self, heading: &str) -> Result<()>

A heading, a line each, on lines of its own: music21’s addHeading.

§Errors

A heading line wider than a line.

Source

pub fn add_long_expression(&mut self, expression: &str) -> Result<()>

Words of a long text expression, each where it fits: music21’s addLongExpression.

§Errors

A word wider than a line.

Source

pub fn add_to_new_line(&mut self, grouping: &str) -> Result<()>

A group of notes on a new line, indented two cells or after the hand’s sign: music21’s addToNewLine.

§Errors

A group wider than a line.

Source

pub fn append_or_insert_current( &mut self, text: &str, add_space: bool, ) -> Result<()>

Text at the end of the line, or on a new one indented two cells: music21’s appendOrInsertCurrent.

§Errors

Text wider than a line.

Source

pub fn add_inaccord(&mut self, inaccord: &str) -> Result<()>

Voices written in accord, on the line or a new one: music21’s addInaccord.

§Errors

Voices wider than a line.

Source

pub fn add_measure_number(&mut self, number: &str) -> Result<()>

A measure number at the start of a line: music21’s addMeasureNumber.

§Errors

A number wider than a line.

Source

pub fn add_measure_number_value(&mut self, number: i64) -> Result<()>

A measure number given as a number.

§Errors

A number wider than a line.

Source

pub fn optional_add_keyboard_symbols_and_dots( &mut self, grouping: Option<&str>, ) -> Result<bool>

The hand’s sign and the dots of a group’s first cell, before the first group of a line, and whether what follows is spaced from it: music21’s optionalAddKeyboardSymbolsAndDots.

§Errors

Signs wider than a line.

Source

pub fn add_signatures(&mut self, signatures: &str) -> Result<()>

Key and time signatures, after a space unless they start the line: music21’s addSignatures.

§Errors

Signatures wider than a line.

Source

pub fn recenter_headings(&mut self)

Each heading line centred over the widest line of music below it, up to the next heading: music21’s recenterHeadings.

Source

pub fn render(&mut self) -> String

The text, headings centred: music21’s __str__.

Trait Implementations§

Source§

impl Clone for BrailleText

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 BrailleText

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for BrailleText

Source§

impl PartialEq for BrailleText

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for BrailleText

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.