Skip to main content

RichMetadata

Struct RichMetadata 

Source
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: Metadata

The 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: OffsetQL

How long it is, in quarter notes.

§source_path: String

Where 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

Source

pub fn of(metadata: Metadata) -> Self

Rich metadata over a score’s own.

Source

pub fn value(&self, name: &str) -> Option<RichValue<'_>>

One of the values read off the score, by its name in RICH_ATTRIBUTES.

Source

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.

Source

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

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 RichMetadata

Source§

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

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

impl Default for RichMetadata

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for RichMetadata

Available on crate feature serde only.
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 PartialEq for RichMetadata

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for RichMetadata

Available on crate feature serde only.
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
Source§

impl StructuralPartialEq for RichMetadata

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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