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

Function as_str

flow-plugins/src/utils/args_parser.rs:27–34  ·  view source on GitHub ↗
(map: &'a Table, key: &str, default: &'a str)

Source from the content-addressed store, hash-verified

25}
26
27pub fn as_str<'a>(map: &'a Table, key: &str, default: &'a str) -> &'a str {
28 map.get(key)
29 .map(|x| {
30 x.as_str()
31 .unwrap_or_else(|| panic!("Invalid arguments in field {}", key))
32 })
33 .unwrap_or(default)
34}
35
36pub fn as_list<'a>(map: &'a Table, key: &str) -> Vec<&'a Value> {
37 map.get(key)

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected