MCPcopy Create free account
hub / github.com/endbasic/endbasic / take_keyed_flag

Method take_keyed_flag

std/src/console/spec.rs:168–179  ·  view source on GitHub ↗

Queries the value of the keyed `flag` from the specification, which may or may not be present. The value is parsed according to the type `V`. The flag is marked as "checked" so that `finish` won't raise it as residual.

(&mut self, key: &str)

Source from the content-addressed store, hash-verified

166 ///
167 /// The flag is marked as "checked" so that `finish` won't raise it as residual.
168 pub fn take_keyed_flag<V>(&mut self, key: &str) -> Result<Option<V>>
169 where
170 V: FromStr,
171 V::Err: Display,
172 {
173 match self.take_keyed_flag_str(key) {
174 Some(v) => V::from_str(v)
175 .map(|v| Some(v))
176 .map_err(|e| mkerror!("Invalid console flag {}: {}", key, e)),
177 None => Ok(None),
178 }
179 }
180
181 /// Validates that all provided flags have been queried by the driver.
182 pub fn finish(self) -> Result<()> {

Callers 1

setupFunction · 0.80

Calls 1

take_keyed_flag_strMethod · 0.80

Tested by

no test coverage detected