fidl_data_zither_bits/
bits.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.bits` 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(IntoBytes, FromBytes, Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
15pub struct Uint8Bits(u8);
16
17bitflags! {
18    impl Uint8Bits : u8 {
19        const ONE = 1 << 0;
20        const TWO = 1 << 1;
21        const FOUR = 1 << 2;
22        const EIGHT = 1 << 3;
23        const SIXTEEN = 1 << 4;
24        const THIRTY_TWO = 1 << 5;
25        const SIXTY_FOUR = 1 << 6;
26        const ONE_HUNDRED_TWENTY_EIGHT = 1 << 7;
27  }
28}
29
30#[repr(C)]
31#[derive(IntoBytes, FromBytes, Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
32pub struct Uint16Bits(u16);
33
34bitflags! {
35    impl Uint16Bits : u16 {
36        const ZEROTH = 1 << 0;
37        const FIRST = 1 << 1;
38        const SECOND = 1 << 2;
39        const THIRD = 1 << 3;
40        const FOURTH = 1 << 4;
41        const FIFTH = 1 << 5;
42        const SIXTH = 1 << 6;
43        const SEVENTH = 1 << 7;
44        const EIGHT = 1 << 8;
45        const NINTH = 1 << 9;
46        const TENTH = 1 << 10;
47        const ELEVENTH = 1 << 11;
48        const TWELFTH = 1 << 12;
49        const THIRTEENTH = 1 << 13;
50        const FOURTEENTH = 1 << 14;
51        const FIFTHTEENTH = 1 << 15;
52  }
53}
54
55#[repr(C)]
56#[derive(IntoBytes, FromBytes, Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
57pub struct Uint32Bits(u32);
58
59bitflags! {
60    impl Uint32Bits : u32 {
61        const POW_0 = 1 << 0;
62        const POW_31 = 1 << 31;
63  }
64}
65
66#[repr(C)]
67#[derive(IntoBytes, FromBytes, Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
68pub struct Uint64Bits(u64);
69
70bitflags! {
71    impl Uint64Bits : u64 {
72        const POW_0 = 1 << 0;
73        const POW_63 = 1 << 63;
74  }
75}
76
77/// Bits with a one-line comment.
78#[repr(C)]
79#[derive(IntoBytes, FromBytes, Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
80pub struct BitsWithOneLineComment(u8);
81
82bitflags! {
83    impl BitsWithOneLineComment : u8 {
84
85        /// Bits member with one-line comment.
86        const MEMBER_WITH_ONE_LINE_COMMENT = 1 << 0;
87
88        /// Bits member
89        ///     with a
90        ///         many-line
91        ///           comment.
92        const MEMBER_WITH_MANY_LINE_COMMENT = 1 << 6;
93  }
94}
95
96/// Bits
97///
98///     with a
99///         many-line
100///           comment.
101#[repr(C)]
102#[derive(IntoBytes, FromBytes, Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
103pub struct BitsWithManyLineComment(u16);
104
105bitflags! {
106    impl BitsWithManyLineComment : u16 {
107        const MEMBER = 1 << 0;
108  }
109}
110
111pub const SEVENTY_TWO: Uint8Bits = Uint8Bits::from_bits_truncate(0b1001000); // Uint8Bits.SIXTY_FOUR | Uint8Bits.EIGHT
112
113pub const SOME_BITS: Uint16Bits = Uint16Bits::from_bits_truncate(0b1001000000010); // Uint16Bits.FIRST | Uint16Bits.NINTH | Uint16Bits.TWELFTH
114
115pub const U32_POW_0: Uint32Bits = Uint32Bits::POW_0;
116
117pub const U64_POW_63: Uint64Bits = Uint64Bits::POW_63;