Skip to main content

unique_name_of

Function unique_name_of 

Source
pub fn unique_name_of(name: &str) -> Option<&'static str>
Expand description

The unique name an attribute name stands for: the name itself, one of music21’s four grandfathered work ids, or one of its twenty Humdrum abbreviations. Nothing for a name outside the vocabulary.

Spelling counts, as it does for music21’s own attribute access: otl and title both name the title, OTL names nothing.

use music21_rs::metadata::unique_name_of;

assert_eq!(unique_name_of("title"), Some("title"));
assert_eq!(unique_name_of("otl"), Some("title"));
assert_eq!(unique_name_of("dedication"), Some("dedicatedTo"));
assert_eq!(unique_name_of("OTL"), None);
assert_eq!(unique_name_of("madeUp"), None);