Skip to main content

MetadataBundle

Struct MetadataBundle 

Source
pub struct MetadataBundle { /* private fields */ }
Expand description

The metadata of many scores, filed by key in the order they were filed: music21’s MetadataBundle.

Entries are shared, not copied, between a bundle and what is searched or combined out of it, so two bundles hold the same entries where music21’s would hold the same objects.

Implementations§

Source§

impl MetadataBundle

Source

pub fn new(name: Option<String>) -> Self

An empty bundle, of the corpus name or of none.

Source

pub fn name(&self) -> Option<&str>

The corpus it belongs to: core, local or a local corpus’s name.

Source

pub fn len(&self) -> usize

How many entries it has.

Source

pub fn is_empty(&self) -> bool

Whether it has none.

Source

pub fn keys(&self) -> Vec<&str>

Its keys, in order.

Source

pub fn get(&self, at: usize) -> Option<(&str, &Arc<MetadataEntry>)>

The entry at a place, with its key.

Source

pub fn entry(&self, key: &str) -> Option<&Arc<MetadataEntry>>

The entry filed under a key.

Source

pub fn iter(&self) -> impl Iterator<Item = (&str, &Arc<MetadataEntry>)>

Every entry with its key, in order.

Source

pub fn insert(&mut self, entry: MetadataEntry)

Files an entry under its corpus path, in place of one already there.

Source

pub fn insert_shared(&mut self, key: String, entry: Arc<MetadataEntry>)

Files a shared entry under a key, in place of one already there.

Source

pub fn clear(&mut self)

Removes every entry: music21’s clear.

Source

pub fn validate(&mut self, exists: impl Fn(&str) -> bool) -> usize

Keeps the entries whose score exists finds, answering how many went: music21’s validate, which leaves finding files to its caller here.

Source

pub fn search( &self, query: &RichQuery<'_>, field: Option<&str>, extensions: &[String], ) -> MetadataBundle

The entries whose metadata a query matches, sorted by source path, in a bundle of no corpus: music21’s search. extensions, where given, are the suffixes kept, dots and all.

Source

pub fn combine( &self, other: &MetadataBundle, operation: SetOperation, ) -> MetadataBundle

The entries of the keys an operation keeps, from this bundle where it has them, sorted by source path, in a bundle of no corpus.

Source

pub fn compare_keys(&self, other: &MetadataBundle) -> Option<Ordering>

How this bundle’s keys stand to another’s: Less for a proper subset, Equal for the same keys, Greater for a proper superset, and nothing where neither holds the other.

Source

pub fn is_disjoint(&self, other: &MetadataBundle) -> bool

Whether no key is in both.

Source

pub fn from_cache(bytes: &[u8]) -> Result<Self>

Reads a bundle from the pickle music21 caches one as.

§Errors

Bytes that are no pickle, or a pickle of anything but a bundle.

Source

pub fn to_cache(&self) -> Vec<u8> ⓘ

The pickle music21 caches a bundle as, protocol 5: music21 reads it with pickle.load.

Trait Implementations§

Source§

impl Clone for MetadataBundle

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 MetadataBundle

Source§

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

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

impl Default for MetadataBundle

Source§

fn default() -> Self

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

impl PartialEq for MetadataBundle

Source§

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

The same entries under the same keys in the same order, as music21 compares two bundles’ OrderedDicts of the same objects.

1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more

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