fidl_data_zither_structs/
structs.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.structs` by zither, a Fuchsia platform tool.
7
8#![allow(unused_imports)]
9
10use bitflags::bitflags;
11use zerocopy::{FromBytes, IntoBytes};
12
13#[repr(C)]
14#[derive(Clone, Copy, Debug, Eq, FromBytes, IntoBytes, PartialEq)]
15pub struct Empty {}
16
17#[repr(C)]
18#[derive(Clone, Copy, Debug, Eq, FromBytes, IntoBytes, PartialEq)]
19pub struct Singleton {
20    pub value: u8,
21}
22
23#[repr(C)]
24#[derive(Clone, Copy, Debug, Eq, FromBytes, IntoBytes, PartialEq)]
25pub struct Doubtleton {
26    pub first: Singleton,
27    pub second: Singleton,
28}
29
30#[repr(C)]
31#[derive(Clone, Copy, Debug, Eq, PartialEq)]
32pub struct PrimitiveMembers {
33    pub i64: i64,
34    pub u64: u64,
35    pub i32: i32,
36    pub u32: u32,
37    pub i16: i16,
38    pub u16: u16,
39    pub i8: i8,
40    pub u8: u8,
41    pub b: bool,
42}
43
44#[repr(C)]
45#[derive(Clone, Copy, Debug, Eq, FromBytes, IntoBytes, PartialEq)]
46pub struct ArrayMembers {
47    pub u8s: [u8; 10],
48    pub singletons: [Singleton; 6],
49    pub nested_arrays1: [[u8; 10]; 20],
50    pub nested_arrays2: [[[i8; 1]; 2]; 3],
51}
52
53#[repr(i32)]
54#[derive(Clone, Copy, Debug, Eq, IntoBytes, PartialEq)]
55pub enum Enum {
56    Zero = 0,
57    One = 1,
58}
59
60impl Enum {
61    pub fn from_raw(raw: i32) -> Option<Self> {
62        match raw {
63            0 => Some(Self::Zero),
64
65            1 => Some(Self::One),
66
67            _ => None,
68        }
69    }
70}
71
72#[repr(C)]
73#[derive(IntoBytes, FromBytes, Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
74pub struct Bits(u16);
75
76bitflags::bitflags! {
77    impl Bits : u16 {
78        const ONE = 1 << 0;
79        const TWO = 1 << 1;
80  }
81}
82
83#[repr(C)]
84#[derive(Clone, Copy, Debug, Eq, PartialEq)]
85pub struct EnumAndBitsMembers {
86    pub e: Enum,
87    pub b: Bits,
88}
89
90/// Struct with a one-line comment.
91#[repr(C)]
92#[derive(Clone, Copy, Debug, Eq, PartialEq)]
93pub struct StructWithOneLineComment {
94    /// Struct member with one-line comment.
95    pub member_with_one_line_comment: u32,
96
97    /// Struct member
98    ///     with a
99    ///         many-line
100    ///           comment.
101    pub member_with_many_line_comment: bool,
102}
103
104/// Struct
105///
106///     with a
107///         many-line
108///           comment.
109#[repr(C)]
110#[derive(Clone, Copy, Debug, Eq, FromBytes, IntoBytes, PartialEq)]
111pub struct StructWithManyLineComment {
112    pub member: u16,
113}