gd_score ======== .. rust:crate:: gd_score :synopsis: Exact musical time, spelled pitches and a flat score shared by readers and engravers. Exact musical time, spelled pitches and a flat score shared by readers and engravers. No file access, font policy or engraving geometry belongs in this crate. .. rubric:: Structs .. rust:struct:: pub struct Duration Written duration and exact scaling. The default is an undotted quarter. .. rubric:: Fields .. rust:field:: pub base: Base Written notehead and flag duration. .. rust:field:: pub dots: u8 Augmentation dots, at most eight. .. rust:field:: pub scale: Ratio Proportional duration, including nested tuplet factors. .. rubric:: Implementations .. rust:impl:: impl Duration :noindex: :for: Duration .. rust:method:: pub fn time(self) -> Result Returns exact time in whole notes. Fails for invalid dots, scale or overflow. .. rubric:: Trait Implementations .. rust:impl:: impl Default for Duration :noindex: :for: Duration :trait: Default .. rust:method:: fn default() -> Self :noindex: .. rust:struct:: pub struct Error A structured diagnostic. Adapters place its span in a retained source file. .. rubric:: Fields .. rust:field:: pub kind: ErrorKind Stable classification. .. rust:field:: pub severity: Severity Whether the drawing remains valid. .. rust:field:: pub span: Span Original notation location, or the default when unplaced. .. rust:field:: pub message: String One concrete explanation. .. rust:field:: pub hint: String A corrective action. .. rubric:: Implementations .. rust:impl:: impl Error :noindex: :for: Error .. rust:method:: pub fn new(kind: ErrorKind, message: impl Into) -> Self Copies an explanation into an unplaced error; performs no input processing. .. rust:method:: pub fn at(mut self, span: Span) -> Self Attaches a source range, consuming and returning the diagnostic. .. rust:method:: pub fn or_at(mut self, span: Span) -> Self Attaches a fallback source range only when this diagnostic is still unplaced. .. rust:method:: pub fn hint(mut self, hint: impl Into) -> Self Adds a corrective action, consuming and returning the diagnostic. .. rust:method:: pub fn warning(mut self) -> Self Marks a diagnostic as recoverable, consuming and returning it. .. rubric:: Trait Implementations .. rust:impl:: impl fmt::Display for Error :noindex: :for: Error :trait: fmt::Display .. rust:method:: fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result :noindex: .. rust:impl:: impl std::error::Error for Error :noindex: :for: Error :trait: std::error::Error .. rust:struct:: pub struct FileId(pub u32) An index into a reader's retained source files. .. rubric:: Implementations .. rust:impl:: impl FileId :noindex: :for: FileId .. rust:associatedconst:: pub const NONE: Self = Self(u32::MAX) Unplaced source sentinel; file zero is the root input file. .. rubric:: Trait Implementations .. rust:impl:: impl Default for FileId :noindex: :for: FileId :trait: Default .. rust:method:: fn default() -> Self :noindex: .. rust:struct:: pub struct Span A half-open byte range in a source file. The default is an unplaced diagnostic. .. rubric:: Fields .. rust:field:: pub file: FileId The source file that owns the range. .. rust:field:: pub start: usize First byte, inclusive. .. rust:field:: pub end: usize Last byte, exclusive. .. rubric:: Implementations .. rust:impl:: impl Span :noindex: :for: Span .. rust:method:: pub fn is_unplaced(self) -> bool Returns whether this span carries no source-file attachment. .. rust:struct:: pub struct Key Tonic and mode, independent of the current octave. .. rubric:: Fields .. rust:field:: pub tonic: Pitch Spelled tonic; octave has no effect on the signature. .. rust:field:: pub mode: Mode Diatonic mode. .. rubric:: Implementations .. rust:impl:: impl Key :noindex: :for: Key .. rust:method:: pub fn alterations(self) -> Result<[Alter; 7], Error> Returns alterations by step from C. Fails when the key needs triple accidentals. .. rust:struct:: pub struct Pitch A spelled pitch; c is octave 0, c' (middle C) is octave 1. .. rubric:: Fields .. rust:field:: pub step: Step Diatonic spelling. .. rust:field:: pub alter: Alter Chromatic alteration. .. rust:field:: pub octave: i8 Count of written octave marks. .. rubric:: Implementations .. rust:impl:: impl Pitch :noindex: :for: Pitch .. rust:method:: pub fn diatonic(self) -> i16 Returns the diatonic index without discarding spelling. .. rust:method:: pub fn chromatic(self) -> i16 Returns semitones relative to c in octave 0. .. rust:method:: pub fn transpose(self, from: Self, to: Self) -> Result Transposes by a spelled interval; fails for an unsupported accidental or octave. .. rust:method:: pub fn transpose_tonic(mut self, mut from: Self, mut to: Self) -> Result Transposes an octave-invariant pitch class such as a key tonic or chord symbol root. .. rust:method:: pub fn check_range(self) -> Result<(), Error> Checks the profile's finite ledger-line range, returning a pitch diagnostic. .. rust:struct:: pub struct Ratio A reduced exact rational with a strictly positive denominator. .. rubric:: Implementations .. rust:impl:: impl Ratio :noindex: :for: Ratio .. rust:associatedconst:: pub const ZERO: Self = Self { num: 0, den: 1 } Exact zero. .. rust:associatedconst:: pub const ONE: Self = Self { num: 1, den: 1 } Exact one. .. rust:method:: pub fn new(num: i64, den: i64) -> Result Reduces a fraction. Fails for a zero denominator or an unrepresentable result. .. rust:method:: pub fn numerator(self) -> i64 Returns the reduced numerator. .. rust:method:: pub fn denominator(self) -> i64 Returns the positive reduced denominator. .. rust:method:: pub fn to_f64(self) -> f64 Converts to a finite floating approximation for geometry, not musical time. .. rust:method:: pub fn checked_add(self, rhs: Self) -> Result Adds two rationals, failing when the reduced result does not fit. .. rust:method:: pub fn checked_sub(self, rhs: Self) -> Result Subtracts two rationals, failing when the reduced result does not fit. .. rust:method:: pub fn checked_mul(self, rhs: Self) -> Result Multiplies two rationals, failing when the reduced result does not fit. .. rust:method:: pub fn checked_div(self, rhs: Self) -> Result Divides two rationals, failing for zero or an unrepresentable reduced result. .. rust:method:: pub fn checked_neg(self) -> Result Negates the value, failing only for the smallest integer numerator. .. rust:method:: pub fn is_integer(self) -> bool Returns whether this value is a whole integer, without converting to floating point. .. rubric:: Trait Implementations .. rust:impl:: impl Default for Ratio :noindex: :for: Ratio :trait: Default .. rust:method:: fn default() -> Self :noindex: .. rust:impl:: impl fmt::Display for Ratio :noindex: :for: Ratio :trait: fmt::Display .. rust:method:: fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result :noindex: .. rust:impl:: impl Ord for Ratio :noindex: :for: Ratio :trait: Ord .. rust:method:: fn cmp(&self, rhs: &Self) -> Ordering :noindex: .. rust:impl:: impl PartialOrd for Ratio :noindex: :for: Ratio :trait: PartialOrd .. rust:method:: fn partial_cmp(&self, rhs: &Self) -> Option :noindex: .. rust:struct:: pub struct StaffId(pub u32) A staff index in a score. .. rust:struct:: pub struct VoiceId(pub u32) A voice index in a score. .. rust:struct:: pub struct EventId(pub u32) An event index in a score. .. rust:struct:: pub struct Moment Exact whole-note time, with grace events ordered before their main note. .. rubric:: Fields .. rust:field:: pub main: Ratio Main musical time. .. rust:field:: pub grace: Ratio Negative grace time before the main moment, or zero. .. rust:struct:: pub struct NoteRef A particular head of a chord event, not merely the event as a whole. .. rubric:: Fields .. rust:field:: pub event: EventId Chord event. .. rust:field:: pub note: u8 Index of the head within its chord. .. rust:struct:: pub struct Score A complete notation model, independent of input syntax and drawing geometry. .. rubric:: Fields .. rust:field:: pub staves: Vec Staves in top-to-bottom order. .. rust:field:: pub groups: Vec Braced or bracketed contiguous groups. .. rust:field:: pub voices: Vec Voices, each owned by one staff. .. rust:field:: pub events: Vec Events addressed by stable indices. .. rust:field:: pub spanners: Vec Ties, slurs, hairpins, beams, tuplets and repeat brackets. .. rust:field:: pub lyrics: Vec Lyric verses attached to notes or exact time. .. rust:field:: pub measures: Vec Measure boundaries and effective meter. .. rust:struct:: pub struct Staff One staff of standard notation or tablature. .. rubric:: Fields .. rust:field:: pub kind: StaffKind Standard notation or tablature. .. rust:field:: pub name: String Full name on the first system. .. rust:field:: pub short_name: String Abbreviation on subsequent systems. .. rust:field:: pub name_markup: Option Optional structured markup for the full instrument name. .. rust:field:: pub short_name_markup: Option Optional structured markup for the abbreviated instrument name. .. rust:struct:: pub struct Voice One of at most four independent rhythmic sequences on a staff. .. rubric:: Fields .. rust:field:: pub staff: StaffId Owning staff. .. rust:field:: pub name: String Optional input name, used to attach lyrics. .. rust:field:: pub events: Vec Chronologically ordered event identifiers. .. rust:field:: pub direction: Direction Default stem policy for this voice. .. rust:struct:: pub struct StaffGroup A connected group of contiguous staves. .. rubric:: Fields .. rust:field:: pub first: StaffId First staff, inclusive. .. rust:field:: pub last: StaffId Last staff, inclusive. .. rust:field:: pub kind: GroupKind Brace or bracket. .. rust:field:: pub name: String Full name of the whole group on the first system, beside its brace or bracket. .. rust:field:: pub short_name: String Abbreviation of the group's name on subsequent systems. .. rust:field:: pub name_markup: Option Optional structured markup for the group's full name. .. rust:field:: pub short_name_markup: Option Optional structured markup for the group's abbreviated name. .. rubric:: Implementations .. rust:impl:: impl StaffGroup :noindex: :for: StaffGroup .. rust:method:: pub fn new(first: StaffId, last: StaffId, kind: GroupKind) -> Self A group of ``kind`` over ``first..=last`` without a name. .. rust:struct:: pub struct Event One timed event with its original location. .. rubric:: Fields .. rust:field:: pub voice: VoiceId Owning voice. .. rust:field:: pub voice_style: Option Local voice policy; None inherits the owning voice's default direction. .. rust:field:: pub column_shift: Option Explicit note-column shift level, as LilyPond's ``horizontal-shift``; None uses the voice policy's level from :rust:fn:`VoiceStyle::column_shift `. .. rust:field:: pub at: Moment Exact start time. .. rust:field:: pub kind: EventKind Musical meaning. .. rust:field:: pub span: Span Source location retained for diagnostics. .. rust:field:: pub marks: Vec Marks attached to this event. .. rust:struct:: pub struct Chord Simultaneous noteheads with one written duration. .. rubric:: Fields .. rust:field:: pub notes: Vec Heads in input order; relative pitch interpretation uses this order. .. rust:field:: pub duration: Duration Written and sounding duration. .. rust:field:: pub direction: Option Explicit stem direction, including neutral; None uses the local voice policy. .. rust:field:: pub auto_beam: bool Whether automatic beaming applies at this event. .. rust:field:: pub grace_slash: bool Whether grace stems are slashed. .. rust:struct:: pub struct Note A spelled pitch and accidental-display requests. .. rubric:: Fields .. rust:field:: pub pitch: Pitch Sounding and written pitch. .. rust:field:: pub forced: bool Print an accidental even when implied by state. .. rust:field:: pub cautionary: bool Put the accidental in parentheses. .. rust:field:: pub string: Option Tablature string that plays the note, 1 for the highest; None lets tablature choose, as :rust:fn:`crate::tab_positions ` describes. .. rust:struct:: pub struct Meter A common meter shared by every staff. .. rubric:: Fields .. rust:field:: pub numerator: u16 Number of denominator units per bar. .. rust:field:: pub denominator: u16 Power-of-two unit denominator. .. rust:field:: pub beats: Vec Optional explicit beaming groups, whose sum is the numerator. .. rust:field:: pub style: MeterStyle How the time signature is drawn. .. rubric:: Trait Implementations .. rust:impl:: impl Default for Meter :noindex: :for: Meter :trait: Default .. rust:method:: fn default() -> Self :noindex: .. rust:struct:: pub struct Spanner A bounded interval such as a slur or tuplet. .. rubric:: Fields .. rust:field:: pub start: NoteRef Opening event or note. .. rust:field:: pub end: NoteRef Closing event or note. .. rust:field:: pub kind: SpannerKind Meaning and drawing policy. .. rust:field:: pub direction: Direction Explicit direction when present. .. rust:field:: pub span: Span Original notation for diagnostics. .. rust:struct:: pub struct Annotation A text or symbol attached to a rhythmic event. .. rubric:: Fields .. rust:field:: pub kind: AnnotationKind Meaning of the mark. .. rust:field:: pub direction: Direction Explicit side, when supplied. .. rust:struct:: pub struct LyricLine One verse below a voice. .. rubric:: Fields .. rust:field:: pub voice: VoiceId Voice whose staff owns the verse. .. rust:field:: pub syllables: Vec Ordered syllables. .. rust:struct:: pub struct Syllable One lyric syllable with a possible hyphen or extender. .. rubric:: Fields .. rust:field:: pub text: String Text to shape. .. rust:field:: pub anchor: Anchor First note or exact moment. .. rust:field:: pub hyphen: bool Join to the next syllable with a hyphen. .. rust:field:: pub extender: Option Last note or moment of a melisma extender. .. rust:field:: pub span: Span Source location for diagnostics. .. rust:struct:: pub struct Measure One measure, including pickups and a final incomplete measure. .. rubric:: Fields .. rust:field:: pub number: u32 Printed measure number; a pickup is zero. .. rust:field:: pub start: Ratio Exact start, inclusive. .. rust:field:: pub end: Ratio Exact end, exclusive. .. rust:field:: pub meter: Meter Effective meter. .. rust:struct:: pub struct TabPosition Where a note is played on a fretted instrument. .. rubric:: Fields .. rust:field:: pub string: u8 String number, 1 for the highest string. .. rust:field:: pub fret: u8 Fret number, 0 for the open string. .. rubric:: Enums .. rust:enum:: pub enum Base A written duration before augmentation dots and proportional scaling. .. rubric:: Variants .. rust:variant:: Breve Two whole notes. .. rust:variant:: Whole One whole note. .. rust:variant:: Half Half a whole note. .. rust:variant:: Quarter A quarter note, the initial inherited duration. .. rust:variant:: Eighth An eighth note. .. rust:variant:: Sixteenth A sixteenth note. .. rust:variant:: ThirtySecond A thirty-second note. .. rust:variant:: SixtyFourth A sixty-fourth note. .. rust:variant:: HundredTwentyEighth A hundred-and-twenty-eighth note. .. rubric:: Implementations .. rust:impl:: impl Base :noindex: :for: Base .. rust:method:: pub fn denominator(self) -> u16 Returns the denominator of a whole-note fraction, or zero for a breve. .. rust:method:: pub fn from_denominator(den: u16) -> Result Reads a supported duration denominator. Zero denotes a breve; others may fail. .. rust:enum:: pub enum ErrorKind Stable problem categories shared by readers and engravers. .. rubric:: Variants .. rust:variant:: Syntax Malformed LilyPond notation. .. rust:variant:: Empty No note, rest or spacer exists. .. rust:variant:: UnknownCommand A command is not known to the profile. .. rust:variant:: Unsupported A known construct is outside the implemented profile. .. rust:variant:: Pitch A pitch or accidental is invalid. .. rust:variant:: Duration A duration is invalid. .. rust:variant:: BarCheck A written bar check is misplaced. .. rust:variant:: Lyrics Lyrics could not all be attached. .. rust:variant:: Include An include was refused or could not be read. .. rust:variant:: ReadLimit The reader exceeded a declared bound. .. rust:variant:: TimeOverflow An exact time does not fit the rational representation. .. rust:variant:: Score A programmatically constructed score violates an invariant. .. rust:variant:: Overfull A single measure exceeds the line width. .. rust:variant:: Font A required font or glyph is unavailable. .. rust:variant:: EngraveLimit Engraving exceeded a declared bound. .. rubric:: Implementations .. rust:impl:: impl ErrorKind :noindex: :for: ErrorKind .. rust:method:: pub fn code(self) -> &'static str Returns the diagnostic's stable code without allocating. .. rust:enum:: pub enum Severity Whether processing can continue after a diagnostic. .. rubric:: Variants .. rust:variant:: Error The input cannot be rendered faithfully. .. rust:variant:: Warning The drawing remains usable. .. rust:enum:: pub enum ColumnAlign Horizontal alignment within a vertical markup column. .. rubric:: Variants .. rust:variant:: Left Left-aligned lines (``\column``, ``\left-column``). .. rust:variant:: Center Centered lines (``\center-column``). .. rust:variant:: Right Right-aligned lines (``\right-column``). .. rust:enum:: pub enum Enclosure A decorative frame or rule drawn around a markup expression. .. rubric:: Variants .. rust:variant:: Box Rectangular frame (``\box``, ``\rounded-box``). .. rust:variant:: Circle Circular or oval frame (``\circle``). .. rust:variant:: Underline Baseline rule (``\underline``). .. rust:enum:: pub enum Markup Rich formatted text and musical symbols independent of LilyPond syntax. .. rubric:: Variants .. rust:variant:: Text(String) Shaped text string. .. rust:variant:: Line(Vec) Horizontal sequence separated by word spaces (``\line``, ``{ ... }``). .. rust:variant:: Concat(Vec) Horizontal sequence with no separating spaces (``\concat``). .. rust:variant:: Column(ColumnAlign, Vec) Vertical stack of lines (``\column``, ``\center-column``, ``\right-column``). .. rust:variant:: Style(StyleChange, Box) A change to the enclosing text style (``\bold``, ``\italic``, ``\upright``, ...). .. rust:variant:: Scaled { scale_percent: u16, shift_percent: i16, body: Box } Relative size percentage and vertical baseline shift in hundredths of an em. .. rust:field:: scale_percent: u16 Font size percentage relative to the enclosing markup (``100`` is unchanged). .. rust:field:: shift_percent: i16 Upward baseline shift in hundredths of the enclosing font size. .. rust:field:: body: Box Scaled child expression. .. rust:variant:: Framed(Enclosure, Box) Frame or underline around an expression. .. rust:variant:: MusicGlyph(String) Named SMuFL glyph from the embedded music font. .. rust:variant:: Dynamic(String) Inline dynamic string rendered with SMuFL dynamic glyphs. .. rust:variant:: Space { horizontal: i16, vertical: i16 } Explicit horizontal and vertical offset in hundredths of a staff space. .. rust:field:: horizontal: i16 Horizontal advance in hundredths of a staff space. .. rust:field:: vertical: i16 Vertical advance in hundredths of a staff space. .. rubric:: Implementations .. rust:impl:: impl Markup :noindex: :for: Markup .. rust:method:: pub fn plain_text(&self) -> String Extracts a readable plain-text summary for accessibility descriptions and metadata. .. rust:method:: pub fn approx_bytes(&self) -> usize Returns a conservative heap footprint estimate in bytes. .. rust:method:: pub fn check(&self, depth: usize) -> Result<(), Error> Validates depth, scale percentages and dynamic letters. .. rust:enum:: pub enum MarkupRole Semantic role for a structured markup annotation on an event. .. rubric:: Variants .. rust:variant:: Script Performance text script (``^\markup``, ``_\markup``, ``\markup``). .. rust:variant:: Tempo Tempo indication (``\tempo \markup ...``). .. rust:variant:: Rehearsal Rehearsal or structural mark (``\mark \markup ...``). .. rust:enum:: pub enum StyleChange How a markup command changes the enclosing style; changes nest, as in LilyPond. .. rubric:: Variants .. rust:variant:: Bold ``\bold``: adds weight. .. rust:variant:: Italic ``\italic``: adds slant. .. rust:variant:: Upright ``\upright``: removes slant and keeps weight. .. rust:variant:: Medium ``\medium``: removes weight and keeps slant. .. rust:variant:: Normal ``\normal-text``: removes both. .. rubric:: Implementations .. rust:impl:: impl StyleChange :noindex: :for: StyleChange .. rust:method:: pub fn apply(self, outer: TextStyle) -> TextStyle The style that results from applying this change inside ``outer``. .. rust:enum:: pub enum Alter A chromatic alteration of a written step; quarter tones are outside the profile. .. rubric:: Variants .. rust:variant:: DoubleFlat Two semitones below the natural step. .. rust:variant:: Flat One semitone below the natural step. .. rust:variant:: Natural The natural step. .. rust:variant:: Sharp One semitone above the natural step. .. rust:variant:: DoubleSharp Two semitones above the natural step. .. rubric:: Implementations .. rust:impl:: impl Alter :noindex: :for: Alter .. rust:method:: pub fn semitones(self) -> i16 Returns the signed semitone offset. .. rust:method:: pub fn from_semitones(value: i16) -> Result Reads an offset, failing for alterations outside the profile. .. rust:enum:: pub enum Mode A diatonic key mode, represented as a rotation of the major scale. .. rubric:: Variants .. rust:variant:: Major Ionian. .. rust:variant:: Dorian Dorian. .. rust:variant:: Phrygian Phrygian. .. rust:variant:: Lydian Lydian. .. rust:variant:: Mixolydian Mixolydian. .. rust:variant:: Minor Aeolian. .. rust:variant:: Locrian Locrian. .. rubric:: Implementations .. rust:impl:: impl Mode :noindex: :for: Mode .. rust:method:: pub fn index(self) -> usize Returns the rotation index of the major scale. .. rust:enum:: pub enum Step A diatonic step, in ascending order from C. .. rubric:: Variants .. rust:variant:: C Do. .. rust:variant:: D Re. .. rust:variant:: E Mi. .. rust:variant:: F Fa. .. rust:variant:: G Sol. .. rust:variant:: A La. .. rust:variant:: B Ti. .. rubric:: Implementations .. rust:impl:: impl Step :noindex: :for: Step .. rust:associatedconst:: pub const ALL: [Self; 7] Every step in diatonic order. .. rust:method:: pub fn index(self) -> i16 Returns this step's index from C, in 0..7. .. rust:method:: pub fn semitones(self) -> i16 Returns the natural semitone distance above C. .. rust:method:: pub fn from_index(index: i16) -> Self Wraps an arbitrary diatonic index to its step, including negative indices. .. rust:enum:: pub enum StaffKind What a staff's lines stand for. .. rubric:: Variants .. rust:variant:: Standard Five lines of standard notation. .. rust:variant:: Tablature Six lines of guitar tablature in :rust:const:`crate::GUITAR_TUNING `, with fret numbers. .. rust:enum:: pub enum Direction A direction, with an automatic house-style default. .. rubric:: Variants .. rust:variant:: Auto Choose by staff position. .. rust:variant:: Up Above the staff, or upward stems. .. rust:variant:: Down Below the staff, or downward stems. .. rust:enum:: pub enum VoiceStyle A local polyphonic policy, independent of the owning voice's identity. .. rubric:: Variants .. rust:variant:: Single Choose stems by staff position, without an inner-voice shift. .. rust:variant:: One First voice: upward stems and the outer note column. .. rust:variant:: Two Second voice: downward stems and the outer note column. .. rust:variant:: Three Third voice: upward stems, shifting right when columns conflict. .. rust:variant:: Four Fourth voice: downward stems, shifting left when columns conflict. .. rubric:: Implementations .. rust:impl:: impl VoiceStyle :noindex: :for: VoiceStyle .. rust:method:: pub fn direction(self) -> Direction Returns the stem and annotation side selected by this local policy. .. rust:method:: pub fn column_shift(self) -> u8 Returns the note-column shift level of this policy: one for the inner voices three and four, zero otherwise. Among columns with one stem direction, a higher level stands further from the stem side's outer column. .. rust:enum:: pub enum GroupKind Visual grouping policy for staves. .. rubric:: Variants .. rust:variant:: Brace PianoStaff and GrandStaff. .. rust:variant:: Bracket StaffGroup, with connected bar lines. .. rust:variant:: Choir ChoirStaff, with separate staff bar lines. .. rust:enum:: pub enum EventKind A rhythmic event or a notation change. .. rubric:: Variants .. rust:variant:: Chord(Chord) One or more pitched noteheads. .. rust:variant:: Rest(Duration) An ordinary rest. .. rust:variant:: Skip(Duration) An invisible rhythmic spacer. .. rust:variant:: MeasureRest(Duration) One or more whole-measure rests. .. rust:variant:: Clef(Clef) A clef change. .. rust:variant:: Key(Key) A key change. .. rust:variant:: Time(Meter) A meter change on a measure boundary. .. rust:variant:: Bar(BarStyle) A visible bar line. .. rust:variant:: Break(BreakRule) A forced or forbidden system break. .. rust:variant:: ChordName(Markup, Duration) A chord-name symbol at this moment, as formatted markup such as a root, a quality and a raised extension. .. rubric:: Implementations .. rust:impl:: impl EventKind :noindex: :for: EventKind .. rust:method:: pub fn duration(&self) -> Option<&Duration> Borrows a rhythmic duration, or returns None for instantaneous notation changes. .. rust:enum:: pub enum Clef A clef and optional octave displacement. .. rubric:: Variants .. rust:variant:: Treble G clef on the second line. .. rust:variant:: Bass F clef on the fourth line. .. rust:variant:: Alto C clef on the middle line. .. rust:variant:: Tenor C clef on the fourth line. .. rust:variant:: Soprano C clef on the first line. .. rust:variant:: TrebleEight G clef sounding an octave lower. .. rust:variant:: BassEight F clef sounding an octave lower. .. rubric:: Implementations .. rust:impl:: impl Clef :noindex: :for: Clef .. rust:method:: pub fn middle(self) -> i16 Returns the diatonic pitch on the middle staff line. .. rust:enum:: pub enum MeterStyle How a time signature is drawn. .. rubric:: Variants .. rust:variant:: Symbol LilyPond's default: 4/4 as the common-time C, 2/2 as the cut-time C and every other meter as numbers. .. rust:variant:: Numbers Every meter as numbers, as ``\numericTimeSignature`` asks. .. rust:enum:: pub enum BarStyle A visible bar-line shape. .. rubric:: Variants .. rust:variant:: Single Ordinary thin bar. .. rust:variant:: Double Two thin bars. .. rust:variant:: Final Thin then thick. .. rust:variant:: Initial Thick then thin. .. rust:variant:: RepeatStart Opening repeat. .. rust:variant:: RepeatEnd Closing repeat. .. rust:variant:: RepeatBoth Closing and opening repeat. .. rust:enum:: pub enum BreakRule A line-break instruction at a bar boundary. .. rubric:: Variants .. rust:variant:: Force End the current system. .. rust:variant:: Forbid Keep the adjacent measures in one system. .. rust:enum:: pub enum SpannerKind An interval's musical meaning. .. rubric:: Variants .. rust:variant:: Tie Connect two notes of exactly equal spelled pitch. .. rust:variant:: Slur Legato slur. .. rust:variant:: PhrasingSlur Phrasing slur. .. rust:variant:: Beam Explicit beam group. .. rust:variant:: Tuplet(u64, u64) Ratio displayed above a tuplet. .. rust:variant:: Crescendo Increasing volume. .. rust:variant:: Decrescendo Decreasing volume. .. rust:variant:: Volta(String) Numbered repeat alternative. .. rust:enum:: pub enum AnnotationKind An articulation, dynamic, script or global mark. .. rubric:: Variants .. rust:variant:: Articulation(String) A named SMuFL articulation. .. rust:variant:: Breath A breathing sign after the note (``\breathe``). .. rust:variant:: Fingering(u8) A finger number in 1..=5. .. rust:variant:: Dynamic(String) A dynamic such as mf or sfz. .. rust:variant:: Text(String, TextStyle) Outlined text, with its simple style. .. rust:variant:: Tempo(String) A tempo instruction. .. rust:variant:: Rehearsal(String) A rehearsal label. .. rust:variant:: Markup(Markup, MarkupRole) Rich formatted markup with its semantic role. .. rust:enum:: pub enum TextStyle A text face chosen from the project's font policy. .. rubric:: Variants .. rust:variant:: Regular Regular text. .. rust:variant:: Bold Bold text. .. rust:variant:: Italic Italic text. .. rust:variant:: BoldItalic Bold italic text, falling back to bold, then italic, when no such face exists. .. rust:enum:: pub enum Anchor A lyric attachment to a specific note or an independently timed lyric. .. rubric:: Variants .. rust:variant:: Note(NoteRef) A note within a chord. .. rust:variant:: Moment(Moment) An exact main or grace moment. .. rubric:: Functions .. rust:function:: pub fn check_score(score: &Score) -> Result<(), Error> Borrows a score and checks reader-independent invariants. Visits events and references once, with logarithmic measure lookups for meter changes. Returns the first invalid reference, duration, ordering, pitch, meter or interval. .. rust:function:: pub fn tab_positions(notes: &[Note]) -> Result, Error> Places the notes of one chord on the strings of :rust:const:`GUITAR_TUNING `, returning one position per note in note order. As LilyPond does by default, a note with a string number keeps that string, and each other note, highest first, takes the highest free string on which its fret lies between 0 and :rust:const:`MAX_FRET `. Fails when a string number is outside 1 to 6, when two notes share a string, or when a note has no free string that can play it. .. rubric:: Constants .. rust:const:: pub const MAX_STAFF_VOICES: usize = 64 The most voice records one staff may hold. At most four of them may sound at once; finished voices stay as records so lyrics can still find them by name. .. rust:const:: pub const GUITAR_TUNING: [Pitch; 6] The open strings of a six-string guitar in standard tuning, string 1 (the highest) first: E4, B3, G3, D3, A2 and E2. .. rust:const:: pub const MAX_FRET: u8 = 24 The highest fret a tablature number may name.