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
impl MetadataBundle
Sourcepub fn name(&self) -> Option<&str>
pub fn name(&self) -> Option<&str>
The corpus it belongs to: core, local or a local corpus’s name.
Sourcepub fn get(&self, at: usize) -> Option<(&str, &Arc<MetadataEntry>)>
pub fn get(&self, at: usize) -> Option<(&str, &Arc<MetadataEntry>)>
The entry at a place, with its key.
Sourcepub fn iter(&self) -> impl Iterator<Item = (&str, &Arc<MetadataEntry>)>
pub fn iter(&self) -> impl Iterator<Item = (&str, &Arc<MetadataEntry>)>
Every entry with its key, in order.
Sourcepub fn insert(&mut self, entry: MetadataEntry)
pub fn insert(&mut self, entry: MetadataEntry)
Files an entry under its corpus path, in place of one already there.
Files a shared entry under a key, in place of one already there.
Sourcepub fn validate(&mut self, exists: impl Fn(&str) -> bool) -> usize
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.
Sourcepub fn search(
&self,
query: &RichQuery<'_>,
field: Option<&str>,
extensions: &[String],
) -> MetadataBundle
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.
Sourcepub fn combine(
&self,
other: &MetadataBundle,
operation: SetOperation,
) -> MetadataBundle
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.
Sourcepub fn compare_keys(&self, other: &MetadataBundle) -> Option<Ordering>
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.
Sourcepub fn is_disjoint(&self, other: &MetadataBundle) -> bool
pub fn is_disjoint(&self, other: &MetadataBundle) -> bool
Whether no key is in both.
Sourcepub fn from_cache(bytes: &[u8]) -> Result<Self>
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.
Trait Implementations§
Source§impl Clone for MetadataBundle
impl Clone for MetadataBundle
Source§impl Debug for MetadataBundle
impl Debug for MetadataBundle
Source§impl Default for MetadataBundle
impl Default for MetadataBundle
Source§impl PartialEq for MetadataBundle
impl PartialEq for MetadataBundle
Auto Trait Implementations§
impl Forget for MetadataBundle
impl Freeze for MetadataBundle
impl Move for MetadataBundle
impl RefUnwindSafe for MetadataBundle
impl Send for MetadataBundle
impl Sync for MetadataBundle
impl Unpin for MetadataBundle
impl UnsafeUnpin for MetadataBundle
impl UnwindSafe for MetadataBundle
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