Skip to main content

experimental_zx_types/
experimental_zx_types.rs

1// Copyright 2022 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// DO NOT EDIT.
6// Generated from FIDL library `zither.experimental.zx.types` by zither, a Fuchsia platform tool.
7
8use zerocopy::{FromBytes, IntoBytes, TryFromBytes};
9
10/// 'a'
11pub const CHAR_CONST: u8 = 97;
12
13pub const SIZE_CONST: usize = 100;
14
15pub const UINTPTR_CONST: usize = 0x1234abcd5678ffff;
16
17#[repr(C)]
18#[derive(Clone, Copy, Debug, Eq, PartialEq, TryFromBytes)]
19pub struct StructWithPrimitives {
20    pub char_field: u8,
21    pub size_field: usize,
22    pub uintptr_field: usize,
23}
24
25pub type Uint8Alias = u8;
26
27#[repr(C)]
28#[derive(Clone, Copy, Debug, Eq, PartialEq, TryFromBytes)]
29pub struct StructWithPointers {
30    pub u64ptr: *const u64,
31    pub charptr: *const u8,
32    pub usizeptr: *const usize,
33    pub byteptr: *const u8,
34    pub voidptr: *const u8,
35    pub aliasptr: *const Uint8Alias,
36}
37
38#[repr(C)]
39#[derive(Clone, Copy, Debug, Eq, FromBytes, IntoBytes, PartialEq)]
40pub struct StructWithStringArrays {
41    pub str: [u8; 10],
42    pub strs: [[u8; 6]; 4],
43}
44
45#[repr(C)]
46#[derive(Clone, Copy, Debug, Eq, FromBytes, IntoBytes, PartialEq)]
47pub struct OverlayStructVariant {
48    pub value: u64,
49}
50
51#[repr(u64)]
52#[derive(Clone, Copy, IntoBytes, TryFromBytes)]
53pub enum OverlayWithEquallySizedVariants {
54    A(u64) = 1,
55    B(i64) = 2,
56    C(OverlayStructVariant) = 3,
57    D(u64) = 4,
58}
59
60#[repr(u64)]
61#[derive(Clone, Copy, TryFromBytes)]
62pub enum OverlayWithDifferentlySizedVariants {
63    A(OverlayStructVariant) = 1,
64    B(u32) = 2,
65    C(bool) = 3,
66}
67
68#[repr(C)]
69#[derive(Clone, Copy, TryFromBytes)]
70pub struct StructWithOverlayMembers {
71    pub overlay1: OverlayWithEquallySizedVariants,
72    pub overlay2: OverlayWithDifferentlySizedVariants,
73}