Skip to main content

translate

Function translate 

Source
pub fn translate<T: Copy>(
    table: &[(&str, T)],
    attribute: &str,
    name: &str,
) -> Result<T>
Expand description

music21’s _attrTranslator: what attribute stands for in table, refused by the name of the attribute it was the value of.

use music21::mei::step::{translate, WRITTEN_ACCIDENTALS};

assert_eq!(translate(&WRITTEN_ACCIDENTALS, "s", "accid").unwrap(), "#");
assert!(translate(&WRITTEN_ACCIDENTALS, "q", "accid").is_err());