MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / parse_enum_value

Function parse_enum_value

cranelift/codegen/src/settings.rs:231–239  ·  view source on GitHub ↗
(value: &str, choices: &[&str])

Source from the content-addressed store, hash-verified

229}
230
231fn parse_enum_value(value: &str, choices: &[&str]) -> SetResult<u8> {
232 match choices.iter().position(|&tag| tag == value) {
233 Some(idx) => Ok(idx as u8),
234 None => Err(SetError::BadValue(format!(
235 "any among {}",
236 choices.join(", ")
237 ))),
238 }
239}
240
241impl Configurable for Builder {
242 fn enable(&mut self, name: &str) -> SetResult<()> {

Callers 1

setMethod · 0.85

Calls 3

OkFunction · 0.85
positionMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected