Skip to main content

Measure

Struct Measure 

Source
pub struct Measure {
Show 25 fields pub number: u32, pub time_sig: Option<TimeSignature>, pub key_sig: Option<KeySignature>, pub clef: Option<Clef>, pub tempo: Option<u16>, pub tempo_ramp_to: Option<u16>, pub instrument_change: Option<InstrumentDefinition>, pub tablature_change: Option<TablatureConfig>, pub barline_left: Barline, pub barline_right: Barline, pub volta: Option<VoltaBracket>, pub tempo_text: Option<String>, pub rehearsal: Option<String>, pub navigation: Option<String>, pub expression_text: Option<String>, pub texts: Vec<StyledText>, pub figured_bass: Vec<FiguredBassFigure>, pub harp_pedal_diagrams: Vec<HarpPedalDiagram>, pub multi_rest_count: Option<u8>, pub system_break: bool, pub page_break: bool, pub section_break: bool, pub voices: [Vec<Note>; 4], pub source_voice_numbers: [Option<u32>; 4], pub actual_length: Option<MeasureLength>,
}

Fields§

§number: u32§time_sig: Option<TimeSignature>§key_sig: Option<KeySignature>§clef: Option<Clef>§tempo: Option<u16>§tempo_ramp_to: Option<u16>

Optional target BPM at this measure’s end. The playback contract linearly interpolates BPM across the measure; None keeps a constant tempo until the next change.

§instrument_change: Option<InstrumentDefinition>

Instrument semantics beginning at this staff-local measure boundary.

§tablature_change: Option<TablatureConfig>

Tablature tuning/capo beginning at this staff-local measure boundary.

§barline_left: Barline§barline_right: Barline§volta: Option<VoltaBracket>§tempo_text: Option<String>§rehearsal: Option<String>§navigation: Option<String>

Navigation mark: “Segno” | “Coda” | “Fine” | “DaCapo” | “DaCapoAlFine” | “DaCapoAlCoda” | “DalSegno” | “DalSegnoAlFine” | “DalSegnoAlCoda” | “ToCoda”

§expression_text: Option<String>

Expression / performance text (“dolce”, “espressivo”, “con fuoco”, etc.).

§texts: Vec<StyledText>§figured_bass: Vec<FiguredBassFigure>

Structured MusicXML figured-bass figures in source order.

§harp_pedal_diagrams: Vec<HarpPedalDiagram>

Concert-harp pedal diagrams declared by MusicXML <harp-pedals> directions.

§multi_rest_count: Option<u8>

When ≥ 2, this measure is displayed as a multi-measure rest spanning N measures.

§system_break: bool

Force a new system (row) after this measure.

§page_break: bool

Force a new page after this measure.

§section_break: bool

Semantic section boundary beginning at this measure. Unlike system and page breaks, this is an editor/navigation marker and has no layout implication.

§voices: [Vec<Note>; 4]

Up to 4 voices; voice 0 is the primary voice.

§source_voice_numbers: [Option<u32>; 4]

Original positive MusicXML voice numbers associated with the four editable slots.

None retains the legacy convention that slot n serializes as voice n + 1. This lets import preserve sparse source identifiers such as voices 1 and 5 without changing the established fixed-slot editing API.

§actual_length: Option<MeasureLength>

Authored length when it differs from the time signature (pickup or irregular bar). None means the measure lasts exactly one bar of its time signature.

Implementations§

Source§

impl Measure

Source

pub fn empty(numerator: u8, denominator: u8) -> Self

Source

pub fn duration_beats(&self, time_signature: &TimeSignature) -> f64

Beats this measure lasts: its actual_length when present and valid, otherwise its own time signature, otherwise time_signature (the one in effect).

Source

pub fn renumber(&mut self, n: u32)

Trait Implementations§

Source§

impl Clone for Measure

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 Measure

Source§

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

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

impl<'de> Deserialize<'de> for Measure

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Measure

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> 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.