MCPcopy Index your code
hub / github.com/cloud-hypervisor/cloud-hypervisor / add

Method add

option_parser/src/lib.rs:184–200  ·  view source on GitHub ↗

Registers a named option that requires a value (i.e. `key=value`). Option names must not contain `"`, `[`, `]`, `=`, or `,`. Returns `&mut Self` for chaining. # Panics Panics if the option name contains a forbidden character.

(&mut self, option: &str)

Source from the content-addressed store, hash-verified

182 ///
183 /// Panics if the option name contains a forbidden character.
184 pub fn add(&mut self, option: &str) -> &mut Self {
185 // Check that option=value has balanced
186 // quotes and brackets iff value does.
187 assert!(
188 !option.contains(['"', '[', ']', '=', ',']),
189 "forbidden character in option name"
190 );
191 self.options.insert(
192 option.to_owned(),
193 OptionParserValue {
194 value: None,
195 requires_value: true,
196 },
197 );
198
199 self
200 }
201
202 /// Registers multiple value-requiring options at once.
203 ///

Callers 15

add_allMethod · 0.80
test_option_parserFunction · 0.80
test_empty_inputFunction · 0.80
test_add_valuelessFunction · 0.80
test_convert_integerFunction · 0.80
test_toggleFunction · 0.80
test_toggle_invalidFunction · 0.80
test_byte_sizedFunction · 0.80

Calls 1

insertMethod · 0.45

Tested by 14

test_option_parserFunction · 0.64
test_empty_inputFunction · 0.64
test_add_valuelessFunction · 0.64
test_convert_integerFunction · 0.64
test_toggleFunction · 0.64
test_toggle_invalidFunction · 0.64
test_byte_sizedFunction · 0.64