MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / from_str

Method from_str

src/ore/src/cli.rs:103–113  ·  view source on GitHub ↗
(s: &str)

Source from the content-addressed store, hash-verified

101 type Err = String;
102
103 fn from_str(s: &str) -> Result<KeyValueArg<K, V>, String> {
104 let mut parts = s.splitn(2, '=');
105 let key = parts.next().expect("always one part");
106 let value = parts
107 .next()
108 .ok_or_else(|| "must have format KEY=VALUE".to_string())?;
109 Ok(KeyValueArg {
110 key: key.parse().map_err(|e| format!("parsing key: {}", e))?,
111 value: value.parse().map_err(|e| format!("parsing value: {}", e))?,
112 })
113 }
114}
115
116/// A command-line argument that defaults to `true`

Callers

nothing calls this directly

Calls 4

expectMethod · 0.80
nextMethod · 0.45
to_stringMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected