(section: &[u8])
| 313 | } |
| 314 | |
| 315 | fn 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`. |
no test coverage detected