MCPcopy Create free account
hub / github.com/bootc-dev/bootc / remove_exact

Method remove_exact

crates/kernel_cmdline/src/bytes.rs:324–341  ·  view source on GitHub ↗

Remove all parameters that exactly match the given parameter from the command line Returns `true` if parameter(s) were removed.

(&mut self, param: &Parameter)

Source from the content-addressed store, hash-verified

322 ///
323 /// Returns `true` if parameter(s) were removed.
324 pub fn remove_exact(&mut self, param: &Parameter) -> bool {
325 let mut removed = false;
326 let mut new_params = Vec::new();
327
328 for p in self.iter() {
329 if p == *param {
330 removed = true;
331 } else {
332 new_params.push(p.parameter);
333 }
334 }
335
336 if removed {
337 self.0 = Cow::Owned(new_params.join(b" ".as_slice()));
338 }
339
340 removed
341 }
342
343 #[cfg(test)]
344 pub(crate) fn is_owned(&self) -> bool {

Callers

nothing calls this directly

Calls 1

iterMethod · 0.45

Tested by

no test coverage detected