debian/rust-vendor/zerocopy/benches/try_transmute.rs
raw| 1 | use zerocopy::Unalign; |
| 2 | use zerocopy_derive::*; |
| 3 | |
| 4 | #[path = "formats/coco_static_size.rs"] |
| 5 | mod format; |
| 6 | |
| 7 | #[derive(IntoBytes, KnownLayout, Immutable)] |
| 8 | #[repr(C)] |
| 9 | struct MinimalViableSource { |
| 10 | bytes: [u8; 6], |
| 11 | } |
| 12 | |
| 13 | #[unsafe(no_mangle)] |
| 14 | fn bench_try_transmute(source: MinimalViableSource) -> Option<Unalign<format::CocoPacket>> { |
| 15 | zerocopy::try_transmute!(source).ok() |
| 16 | } |