Skip to main content

accepted

Function accepted 

Source
pub fn accepted(key: &str, value: &str) -> Result<String>
Expand description

value as showFormat, writeFormat or autoDownload takes it: in lower case, and an error where it is not one music21 allows. Any other preference takes any value, and value comes back as it was given.

use music21::environment::accepted;

assert_eq!(accepted("showFormat", "MusicXML").unwrap(), "musicxml");
assert_eq!(
    accepted("autoDownload", "asdf").unwrap_err().to_string(),
    "Environment error: asdf is not an acceptable value for preference: autoDownload"
);