MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / from_str

Method from_str

option_parser/src/lib.rs:305–314  ·  view source on GitHub ↗
(s: &str)

Source from the content-addressed store, hash-verified

303 type Err = ToggleParseError;
304
305 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
306 match s.to_lowercase().as_str() {
307 "" => Ok(Toggle(false)),
308 "on" => Ok(Toggle(true)),
309 "off" => Ok(Toggle(false)),
310 "true" => Ok(Toggle(true)),
311 "false" => Ok(Toggle(false)),
312 _ => Err(ToggleParseError::InvalidValue(s.to_owned())),
313 }
314 }
315}
316
317/// A byte size parsed from a human-readable string with optional `K`, `M`, or `G` suffix.

Callers

nothing calls this directly

Calls 14

ToggleClass · 0.85
ByteSizedClass · 0.85
newFunction · 0.85
IntegerListClass · 0.85
split_commasFunction · 0.85
TupleClass · 0.85
dequoteFunction · 0.85
StringListClass · 0.85
iterMethod · 0.80
as_bytesMethod · 0.80
lenMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected