mirror of
https://github.com/Lokathor/bytemuck.git
synced 2024-11-22 06:42:25 +00:00
25 lines
403 B
Rust
25 lines
403 B
Rust
|
#![cfg(feature = "derive")]
|
||
|
#![allow(dead_code)]
|
||
|
|
||
|
use bytemuck::{Zeroable, Pod, TransparentWrapper};
|
||
|
|
||
|
#[derive(Copy, Clone, Pod, Zeroable)]
|
||
|
#[repr(C)]
|
||
|
struct Test {
|
||
|
a: u16,
|
||
|
b: u16,
|
||
|
}
|
||
|
|
||
|
#[derive(TransparentWrapper)]
|
||
|
#[repr(transparent)]
|
||
|
struct TransparentSingle {
|
||
|
a: u16,
|
||
|
}
|
||
|
|
||
|
#[derive(TransparentWrapper)]
|
||
|
#[repr(transparent)]
|
||
|
#[transparent(u16)]
|
||
|
struct TransparentWithZeroSized {
|
||
|
a: u16,
|
||
|
b: ()
|
||
|
}
|