summaryrefslogtreecommitdiff
path: root/rust/zerocopy/benches/try_read_from_prefix.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rust/zerocopy/benches/try_read_from_prefix.rs')
-rw-r--r--rust/zerocopy/benches/try_read_from_prefix.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/rust/zerocopy/benches/try_read_from_prefix.rs b/rust/zerocopy/benches/try_read_from_prefix.rs
new file mode 100644
index 000000000..fabbac3bd
--- /dev/null
+++ b/rust/zerocopy/benches/try_read_from_prefix.rs
@@ -0,0 +1,10 @@
+#[path = "formats/coco_static_size.rs"]
+mod format;
+
+#[unsafe(no_mangle)]
+fn bench_try_read_from_prefix_static_size(source: &[u8]) -> Option<format::CocoPacket> {
+ match zerocopy::TryFromBytes::try_read_from_prefix(source) {
+ Ok((packet, _rest)) => Some(packet),
+ _ => None,
+ }
+}