Skip to main content

corpus_path_to_key

Function corpus_path_to_key 

Source
pub fn corpus_path_to_key(source: KeySource<'_>, number: Option<&str>) -> String
Expand description

The key a score is filed under in a bundle: its corpus path with every separator and dot an underscore, and its number in an opus after it: music21’s MetadataBundle.corpusPathToKey.

use music21::metadata::bundles::{KeySource, corpus_path_to_key};

let key = corpus_path_to_key(KeySource::Text("corelli/opus3no1/1grave.xml"), Some("3"));
assert_eq!(key, "corelli_opus3no1_1grave_xml_3");