1use zerocopy::{FromBytes, IntoBytes, TryFromBytes};
9
10#[repr(u32)]
11#[derive(Clone, Copy, Debug, Eq, Hash, IntoBytes, PartialEq, TryFromBytes)]
12pub enum Subtype {
13 A = 0,
14 B = 1,
15}
16
17impl Subtype {
18 pub fn from_raw(raw: u32) -> Option<Self> {
19 match raw {
20 0 => Some(Self::A),
21
22 1 => Some(Self::B),
23
24 _ => None,
25 }
26 }
27}
28
29impl From<Subtype> for u32 {
30 fn from(val: Subtype) -> Self {
31 val as Self
32 }
33}
34
35pub type Handle = u32;
37
38#[repr(C)]
39#[derive(Clone, Copy, Debug, Eq, FromBytes, IntoBytes, PartialEq)]
40pub struct StructWithHandleMembers {
41 pub untyped_handle: Handle,
42 pub handle_a: Handle,
43 pub handle_b: Handle,
44}