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

Method require_value_of

crates/kernel_cmdline/src/bytes.rs:197–203  ·  view source on GitHub ↗

Find the value of the kernel argument with the provided name, which must be present. Otherwise the same as [`Self::value_of`].

(&'a self, key: &T)

Source from the content-addressed store, hash-verified

195 ///
196 /// Otherwise the same as [`Self::value_of`].
197 pub fn require_value_of<T: AsRef<[u8]> + ?Sized>(&'a self, key: &T) -> Result<&'a [u8]> {
198 let key = key.as_ref();
199 self.value_of(key).ok_or_else(|| {
200 let key = String::from_utf8_lossy(key);
201 anyhow::anyhow!("Failed to find kernel argument '{key}'")
202 })
203 }
204
205 /// Add a parameter to the command line if it doesn't already exist
206 ///

Callers 1

test_require_value_ofFunction · 0.45

Calls 2

as_refMethod · 0.45
value_ofMethod · 0.45

Tested by 1

test_require_value_ofFunction · 0.36