pub struct RichMetadata {Show 14 fields
pub metadata: Metadata,
pub ambitus: Option<AmbitusShort>,
pub key_signature_first: Option<IntegerType>,
pub key_signatures: Vec<IntegerType>,
pub note_count: Option<IntegerType>,
pub number_of_parts: Option<IntegerType>,
pub pitch_highest: Option<String>,
pub pitch_lowest: Option<String>,
pub score_quarter_length: OffsetQL,
pub source_path: String,
pub tempo_first: Option<String>,
pub tempos: Vec<String>,
pub time_signature_first: Option<String>,
pub time_signatures: Vec<String>,
}Expand description
A score’s metadata and what was read off the score: music21’s
RichMetadata.
use music21::metadata::rich::{RichMetadata, RichQuery};
use music21::tinynotation::from_tiny_notation;
let line = from_tiny_notation("3/4 c4 d e g a b")?;
let mut rich = RichMetadata::default();
rich.update(&line, None)?;
assert_eq!(rich.time_signatures, ["3/4"]);
assert_eq!(rich.note_count, Some(6));
assert_eq!(rich.search(&RichQuery::Text("3/4"), None), Some(Some("timeSignatureFirst")));Fields§
§metadata: MetadataThe score’s own metadata.
ambitus: Option<AmbitusShort>The range of its pitches.
key_signature_first: Option<IntegerType>The sharps of its first key signature.
key_signatures: Vec<IntegerType>The sharps of every key signature, each once, in order.
note_count: Option<IntegerType>How many notes, chords and rests it has.
number_of_parts: Option<IntegerType>How many parts it has.
pitch_highest: Option<String>Its highest pitch, by name with octave.
pitch_lowest: Option<String>Its lowest pitch, by name with octave.
score_quarter_length: OffsetQLHow long it is, in quarter notes.
source_path: StringWhere it lives in the corpus, a POSIX path.
tempo_first: Option<String>Its first tempo, as music21 writes it.
tempos: Vec<String>Every tempo, each once, in order.
time_signature_first: Option<String>Its first meter, 3/4.
time_signatures: Vec<String>Every meter, each once, in order.
Implementations§
Source§impl RichMetadata
impl RichMetadata
Sourcepub fn value(&self, name: &str) -> Option<RichValue<'_>>
pub fn value(&self, name: &str) -> Option<RichValue<'_>>
One of the values read off the score, by its name in
RICH_ATTRIBUTES.
Sourcepub fn update(&mut self, stream: &Stream, corpus: Option<&Path>) -> Result<()>
pub fn update(&mut self, stream: &Stream, corpus: Option<&Path>) -> Result<()>
Reads the thirteen values off a score: music21’s update.
corpus is the corpus directory, which a score’s file path is
written relative to where it holds no corpus path of its own.
§Errors
A span of pitches no interval names.
Sourcepub fn search(
&self,
query: &RichQuery<'_>,
field: Option<&str>,
) -> Option<Option<&str>>
pub fn search( &self, query: &RichQuery<'_>, field: Option<&str>, ) -> Option<Option<&str>>
The first value a query matches, and the field it was found under,
searching the score’s values beside its metadata: music21’s
RichMetadata.search. None where nothing matched; Some(None)
for a contributor with no role.
Trait Implementations§
Source§impl Clone for RichMetadata
impl Clone for RichMetadata
Source§impl Debug for RichMetadata
impl Debug for RichMetadata
Source§impl Default for RichMetadata
impl Default for RichMetadata
Source§impl<'de> Deserialize<'de> for RichMetadata
Available on crate feature serde only.
impl<'de> Deserialize<'de> for RichMetadata
serde only.Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for RichMetadata
impl PartialEq for RichMetadata
Source§impl Serialize for RichMetadata
Available on crate feature serde only.
impl Serialize for RichMetadata
serde only.impl StructuralPartialEq for RichMetadata
Auto Trait Implementations§
impl Forget for RichMetadata
impl Freeze for RichMetadata
impl Move for RichMetadata
impl RefUnwindSafe for RichMetadata
impl Send for RichMetadata
impl Sync for RichMetadata
impl Unpin for RichMetadata
impl UnsafeUnpin for RichMetadata
impl UnwindSafe for RichMetadata
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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