Skip to main content

choice

Function choice 

Source
pub fn choice(choices: &[&'static str], s: &str) -> Option<&'static str>
Expand description

The accepted value that s names, compared without ASCII case: the one rule of the accepted values of the blocks, for the check of a parameter and its parsing alike.

ยงExamples

use comnum_spec::blocks::schema::choice;
assert_eq!(choice(&["signal", "unit"], "Unit"), Some("unit"));
assert_eq!(choice(&["signal", "unit"], "peak"), None);