summaryrefslogtreecommitdiffstats
path: root/rust/zerocopy/benches/transmute.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rust/zerocopy/benches/transmute.rs')
-rw-r--r--rust/zerocopy/benches/transmute.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/rust/zerocopy/benches/transmute.rs b/rust/zerocopy/benches/transmute.rs
new file mode 100644
index 000000000..e60bfb252
--- /dev/null
+++ b/rust/zerocopy/benches/transmute.rs
@@ -0,0 +1,16 @@
+use zerocopy::Unalign;
+use zerocopy_derive::*;
+
+#[path = "formats/coco_static_size.rs"]
+mod format;
+
+#[derive(IntoBytes, KnownLayout, Immutable)]
+#[repr(C)]
+struct MinimalViableSource {
+ bytes: [u8; 6],
+}
+
+#[unsafe(no_mangle)]
+fn bench_transmute(source: MinimalViableSource) -> Unalign<format::LocoPacket> {
+ zerocopy::transmute!(source)
+}