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

Method find_utf8

crates/kernel_cmdline/src/bytes.rs:163–173  ·  view source on GitHub ↗

Locate a kernel argument with the given key name. Returns an error if a parameter with the given key name is found, but the value is not valid UTF-8. Otherwise, returns the first parameter matching the given key, or `None` if not found. Key comparison treats dashes and underscores as equivalent.

(
        &'a self,
        key: &T,
    )

Source from the content-addressed store, hash-verified

161 /// or `None` if not found. Key comparison treats dashes and
162 /// underscores as equivalent.
163 pub fn find_utf8<T: AsRef<[u8]> + ?Sized>(
164 &'a self,
165 key: &T,
166 ) -> Result<Option<utf8::Parameter<'a>>> {
167 let bytes = match self.find(key.as_ref()) {
168 Some(p) => p,
169 None => return Ok(None),
170 };
171
172 Ok(Some(utf8::Parameter::try_from(bytes)?))
173 }
174
175 /// Find all kernel arguments starting with the given prefix.
176 ///

Callers 2

test_kargs_find_utf8Function · 0.80

Calls 2

findMethod · 0.45
as_refMethod · 0.45

Tested by 1

test_kargs_find_utf8Function · 0.64