MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / parse

Function parse

crates/environ/src/trap_encoding.rs:315–323  ·  view source on GitHub ↗
(section: &[u8])

Source from the content-addressed store, hash-verified

313}
314
315fn parse(section: &[u8]) -> Option<(&[U32<LittleEndian>], &[u8])> {
316 let mut section = Bytes(section);
317 // NB: this matches the encoding written by `append_to` above.
318 let count = section.read::<U32<LittleEndian>>().ok()?;
319 let count = usize::try_from(count.get(LittleEndian)).ok()?;
320 let (offsets, traps) = object::slice_from_bytes::<U32<LittleEndian>>(section.0, count).ok()?;
321 debug_assert_eq!(traps.len(), count);
322 Some((offsets, traps))
323}
324
325/// Returns an iterator over all of the traps encoded in `section`, which should
326/// have been produced by `TrapEncodingBuilder`.

Callers 7

lookup_trap_codeFunction · 0.70
iterate_trapsFunction · 0.70
lookupMethod · 0.70
iterMethod · 0.70
alternate_lookup_keyFunction · 0.50
roundtripFunction · 0.50
mainFunction · 0.50

Calls 2

okMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected