pub struct Part { /* private fields */ }Expand description
A part’s lines and the stage they are written in: music21’s
MuseDataPart.
Implementations§
Source§impl Part
impl Part
Sourcepub fn with_stage(lines: Vec<String>, stage: Stage) -> Self
pub fn with_stage(lines: Vec<String>, stage: Stage) -> Self
A part of lines already read, in stage: music21’s
MuseDataPart(src, stage) for a source it keeps as it is.
Sourcepub fn stage_of(lines: &[String]) -> Stage
pub fn stage_of(lines: &[String]) -> Stage
music21’s _determineStage: stage 2 where any line is an attribute
record.
Sourcepub fn scrubbed(lines: &[String]) -> Result<Vec<String>>
pub fn scrubbed(lines: &[String]) -> Result<Vec<String>>
music21’s _scrubStage1: the lines without the blank ones they open
with.
§Errors
Lines of one or none.
Sourcepub fn lines(&self) -> &[String]
pub fn lines(&self) -> &[String]
The part’s lines, a stage-1 part’s leading blank lines dropped.
Sourcepub fn digits_after(line: &str, tag: &str) -> String
pub fn digits_after(line: &str, tag: &str) -> String
music21’s _getDigitsFollowingTag: the digits after a tag, spaces
passed over, - and / kept, anything else ending it.
use music21::musedata::Part;
assert_eq!(Part::digits_after("$ K:-3 Q:4 T:3/4 C:22", "T:"), "3/4");Sourcepub fn letters_after(
line: &str,
tag: &str,
spaces: Spaces,
case: Case,
) -> String
pub fn letters_after( line: &str, tag: &str, spaces: Spaces, case: Case, ) -> String
music21’s _getAlphasFollowingTag: the letters and commas after a
tag, spaces passed over or kept, anything else ending it; with
Case::Lowered line and tag are lowered first.
use music21::musedata::{Case, Part, Spaces};
let line = "Group memberships: sound, score";
let read = Part::letters_after(line, "Group memberships:", Spaces::Dropped, Case::Lowered);
assert_eq!(read, "sound,score");Sourcepub fn group_memberships(&self) -> Vec<String>
pub fn group_memberships(&self) -> Vec<String>
music21’s getGroupMemberships: the groups the part belongs to.
Sourcepub fn group_total(&self, membership: &str) -> Result<Option<IntegerType>>
pub fn group_total(&self, membership: &str) -> Result<Option<IntegerType>>
music21’s getGroupMembershipsTotal: how many parts the group has.
§Errors
A count that is no number.
Sourcepub fn group_number(&self, membership: &str) -> Result<Option<String>>
pub fn group_number(&self, membership: &str) -> Result<Option<String>>
music21’s getGroupMembershipNumber: the part’s place in the group,
as written. music21 hands stage 1’s back as text, stage 2’s as a
number.
§Errors
A stage-1 header too short.
Sourcepub fn work_number(&self) -> Option<String>
pub fn work_number(&self) -> Option<String>
music21’s getWorkNumber: the opus number, as written.
Sourcepub fn movement_number(&self) -> Option<String>
pub fn movement_number(&self) -> Option<String>
music21’s getMovementNumber, as written.
Sourcepub fn work_title(&self) -> Option<String>
pub fn work_title(&self) -> Option<String>
music21’s getWorkTitle: for stage 1, the catalogue number.
Sourcepub fn movement_title(&self) -> Option<String>
pub fn movement_title(&self) -> Option<String>
music21’s getMovementTitle; none for stage 1.
Sourcepub fn attributes(&self) -> Result<String>
pub fn attributes(&self) -> Result<String>
music21’s _getAttributesRecord: the first line opening with $,
or stage 1’s two attribute lines joined.
§Errors
A part with no attribute record.
Sourcepub fn key_parameters(&self) -> Result<IntegerType>
pub fn key_parameters(&self) -> Result<IntegerType>
music21’s getKeyParameters: the signature’s sharps, flats below
nought.
§Errors
A key that is no number.
Sourcepub fn key_signature(&self) -> Result<KeySignature>
pub fn key_signature(&self) -> Result<KeySignature>
Sourcepub fn time_signature(&self) -> Result<TimeSignature>
pub fn time_signature(&self) -> Result<TimeSignature>
Sourcepub fn time_signature_parameters(&self) -> Result<String>
pub fn time_signature_parameters(&self) -> Result<String>
music21’s getTimeSignatureParameters: the meter as 3/4, a meter
of 1/1 or over nought as 4/4.
§Errors
A meter that is not two numbers.
Sourcepub fn staff_count(&self) -> Result<IntegerType>
pub fn staff_count(&self) -> Result<IntegerType>
Sourcepub fn clef_parameters(&self) -> Result<Vec<String>>
pub fn clef_parameters(&self) -> Result<Vec<String>>
music21’s _getClefParameters: C:, or each staff’s Cn:, as
written; stage 1’s ninth attribute field.
§Errors
A part with no attribute record.
Sourcepub fn clef_for(&self, voice: usize) -> Result<Option<Clef>>
pub fn clef_for(&self, voice: usize) -> Result<Option<Clef>>
music21’s getClefObject: the clef of staff voice, counted from
one; none for stage 1.
§Errors
No clef for the staff, or a code music21 does not know.
Sourcepub fn transposition(&self) -> Result<Option<Interval>>
pub fn transposition(&self) -> Result<Option<Interval>>
music21’s getTranspositionIntervalObject: the interval a
transposing part is written at.
§Errors
A transposition with no interval.
Sourcepub fn transposition_parameters(&self) -> Result<Option<IntegerType>>
pub fn transposition_parameters(&self) -> Result<Option<IntegerType>>
Trait Implementations§
Auto Trait Implementations§
impl Forget for Part
impl Freeze for Part
impl Move for Part
impl RefUnwindSafe for Part
impl Send for Part
impl Sync for Part
impl Unpin for Part
impl UnsafeUnpin for Part
impl UnwindSafe for Part
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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