MCPcopy Create free account
hub / github.com/MegEngine/MegFlow / as_bool

Function as_bool

flow-plugins/src/utils/args_parser.rs:18–25  ·  view source on GitHub ↗
(map: &Table, key: &str, default: bool)

Source from the content-addressed store, hash-verified

16}
17
18pub fn as_bool(map: &Table, key: &str, default: bool) -> bool {
19 map.get(key)
20 .map(|x| {
21 x.as_bool()
22 .unwrap_or_else(|| panic!("Invalid arguments in field {}", key))
23 })
24 .unwrap_or(default)
25}
26
27pub fn as_str<'a>(map: &'a Table, key: &str, default: &'a str) -> &'a str {
28 map.get(key)

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected