MCPcopy Create free account
hub / github.com/FrameworkComputer/framework-system / find_sequence

Function find_sequence

framework_lib/src/util.rs:259–263  ·  view source on GitHub ↗

Find a sequence of bytes in a long slice of bytes

(haystack: &[u8], needle: &[u8])

Source from the content-addressed store, hash-verified

257
258/// Find a sequence of bytes in a long slice of bytes
259pub fn find_sequence(haystack: &[u8], needle: &[u8]) -> Option<usize> {
260 haystack
261 .windows(needle.len())
262 .position(|window| window == needle)
263}
264
265/// Assert length of an EC response from the windows driver
266/// It's always 20 more than expected. TODO: Figure out why

Callers 5

find_retimer_versionFunction · 0.85
find_bios_versionFunction · 0.85
find_ec_in_bios_capFunction · 0.85
find_pd_in_bios_capFunction · 0.85
flash_firmwareFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected