| // Copyright 2022 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| /// This library is used to test struct bindings. |
| library zither.structs; |
| |
| type Empty = struct {}; |
| |
| type Singleton = struct { |
| value uint8; |
| }; |
| |
| type Doubtleton = struct { |
| first Singleton; |
| second Singleton; |
| }; |
| |
| type PrimitiveMembers = struct { |
| i64 int64; |
| u64 uint64; |
| i32 int32; |
| u32 uint32; |
| i16 int16; |
| u16 uint16; |
| i8 int8; |
| u8 uint8; |
| b bool; |
| }; |
| |
| type ArrayMembers = struct { |
| u8s array<uint8, 10>; |
| singletons array<Singleton, 6>; |
| nested_arrays1 array<array<uint8, 10>, 20>; |
| nested_arrays2 array<array<array<int8, 1>, 2>, 3>; |
| }; |
| |
| type Enum = enum : int32 { |
| ZERO = 0; |
| ONE = 1; |
| }; |
| |
| type Bits = bits : uint16 { |
| ONE = 1; |
| TWO = 2; |
| }; |
| |
| type EnumAndBitsMembers = struct { |
| e Enum; |
| b Bits; |
| }; |
| |
| /// Struct with a one-line comment. |
| type StructWithOneLineComment = struct { |
| /// Struct member with one-line comment. |
| member_with_one_line_comment uint32; |
| |
| /// Struct member |
| /// with a |
| /// many-line |
| /// comment. |
| member_with_many_line_comment bool; |
| }; |
| |
| |
| /// Struct |
| /// |
| /// with a |
| /// many-line |
| /// comment. |
| type StructWithManyLineComment = struct { |
| member uint16; |
| }; |