pub struct Measure {Show 27 fields
pub number: u32,
pub time_sig: Option<TimeSignature>,
pub key_sig: Option<KeySignature>,
pub clef: Option<Clef>,
pub mid_clefs: Vec<MidMeasureClef>,
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>,
pub measure_repeat: Option<u8>,
}Fields§
§number: u32§time_sig: Option<TimeSignature>§key_sig: Option<KeySignature>§clef: Option<Clef>§mid_clefs: Vec<MidMeasureClef>Clef changes inside the bar, in increasing offset order, each strictly after the
bar’s start and before its end. Notes from an offset on are read in that 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 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: boolForce a new system (row) after this measure.
page_break: boolForce a new page after this measure.
section_break: boolSemantic 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.
measure_repeat: Option<u8>Display this measure as a repeat of the previous n measures (MuseScore measure repeat,
MusicXML <measure-repeat>). Its voices hold a copy of the repeated content, so playback,
validation, and editing see real notes; renderers draw the repeat sign instead.
Implementations§
Source§impl Measure
impl Measure
Sourcepub fn clef_at(&self, start_clef: &Clef, beats: f64) -> Clef
pub fn clef_at(&self, start_clef: &Clef, beats: f64) -> Clef
The clef in effect beats quarter-note beats into this bar, given the clef in effect
at its start (after Measure::clef): the latest mid-bar change at or before beats.
pub fn empty(numerator: u8, denominator: u8) -> Self
Sourcepub fn repeat_content_from(&mut self, source: &Measure)
pub fn repeat_content_from(&mut self, source: &Measure)
Replace this measure’s voices with a playable copy of source, as a measure repeat
stores its repeated content; see Note::repeated_copy.
Sourcepub fn same_sounding_content(&self, other: &Measure) -> bool
pub fn same_sounding_content(&self, other: &Measure) -> bool
Whether this measure’s voices sound like other’s: the same rests, pitches, durations,
dots, and tuplets in every voice.
Sourcepub fn duration_beats(&self, time_signature: &TimeSignature) -> f64
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).