diff --git a/vmm/src/config.rs b/vmm/src/config.rs index c93ba691f..045276357 100644 --- a/vmm/src/config.rs +++ b/vmm/src/config.rs @@ -246,6 +246,22 @@ impl<'a> VmParams<'a> { } } +struct Toggle(bool); + +enum ToggleParseError { + InvalidValue(String), +} + +impl FromStr for Toggle { + type Err = ToggleParseError; + + fn from_str(s: &str) -> std::result::Result { + Ok(Toggle(parse_on_off(s).map_err(|_| { + ToggleParseError::InvalidValue(s.to_owned()) + })?)) + } +} + fn parse_size(size: &str) -> Result { let s = size.trim();