summaryrefslogtreecommitdiff
path: root/rust/zerocopy/benches/try_ref_from_prefix_with_elems_dynamic_padding.rs
blob: 1744a40759b16488df0503416cd55b303f6a4fc9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#[path = "formats/coco_dynamic_padding.rs"]
mod format;

#[unsafe(no_mangle)]
fn bench_try_ref_from_prefix_with_elems_dynamic_padding(
    source: &[u8],
    count: usize,
) -> Option<&format::CocoPacket> {
    match zerocopy::TryFromBytes::try_ref_from_prefix_with_elems(source, count) {
        Ok((packet, _rest)) => Some(packet),
        _ => None,
    }
}