├── .github
└── workflows
│ └── CI.yaml
├── .gitignore
├── Cargo.toml
├── LICENSE
├── README.md
├── about.hbs
├── about.toml
├── build.rs
├── rust
├── benches
│ └── void.rs
├── examples
│ └── simple.rs
├── gen_flatbuffers
│ ├── mod.rs
│ ├── sig_bin
│ │ ├── basic_block_generated.rs
│ │ ├── data_generated.rs
│ │ ├── function_constraint_generated.rs
│ │ ├── function_constraints_generated.rs
│ │ └── function_generated.rs
│ ├── symbol_bin
│ │ ├── data_symbol_class_generated.rs
│ │ ├── function_symbol_class_generated.rs
│ │ ├── symbol_class_generated.rs
│ │ ├── symbol_generated.rs
│ │ └── symbol_modifiers_generated.rs
│ └── type_bin
│ │ ├── access_alignment_generated.rs
│ │ ├── array_generated.rs
│ │ ├── array_modifiers_generated.rs
│ │ ├── bit_offset_generated.rs
│ │ ├── bit_shift_generated.rs
│ │ ├── bit_size_generated.rs
│ │ ├── bit_width_generated.rs
│ │ ├── boolean_generated.rs
│ │ ├── calling_convention_generated.rs
│ │ ├── character_generated.rs
│ │ ├── computed_type_generated.rs
│ │ ├── constant_modifier_class_generated.rs
│ │ ├── data_generated.rs
│ │ ├── descriptor_modifier_class_generated.rs
│ │ ├── enumeration_generated.rs
│ │ ├── enumeration_member_generated.rs
│ │ ├── fixed_alignment_generated.rs
│ │ ├── float_generated.rs
│ │ ├── function_generated.rs
│ │ ├── function_member_generated.rs
│ │ ├── function_member_location_generated.rs
│ │ ├── integer_generated.rs
│ │ ├── location_class_generated.rs
│ │ ├── metadata_modifier_class_generated.rs
│ │ ├── pointer_addressing_generated.rs
│ │ ├── pointer_generated.rs
│ │ ├── referrer_generated.rs
│ │ ├── register_location_generated.rs
│ │ ├── stack_location_generated.rs
│ │ ├── structure_generated.rs
│ │ ├── structure_member_generated.rs
│ │ ├── structure_member_modifiers_generated.rs
│ │ ├── type_alignment_generated.rs
│ │ ├── type_class_generated.rs
│ │ ├── type_generated.rs
│ │ ├── type_modifier_class_generated.rs
│ │ ├── type_modifier_generated.rs
│ │ ├── union_generated.rs
│ │ ├── union_member_generated.rs
│ │ ├── unsigned_bit_offset_generated.rs
│ │ ├── void_generated.rs
│ │ └── volatile_modifier_class_generated.rs
├── lib.rs
├── signature.rs
├── signature
│ ├── basic_block.rs
│ ├── function.rs
│ └── function
│ │ └── constraints.rs
├── symbol.rs
├── symbol
│ └── class.rs
├── type.rs
└── type
│ ├── class.rs
│ ├── class
│ ├── array.rs
│ ├── boolean.rs
│ ├── character.rs
│ ├── enumeration.rs
│ ├── float.rs
│ ├── function.rs
│ ├── integer.rs
│ ├── pointer.rs
│ ├── referrer.rs
│ ├── structure.rs
│ ├── union.rs
│ └── void.rs
│ ├── guid.rs
│ └── modifier.rs
├── signature.fbs
├── sigview
├── Cargo.toml
└── src
│ ├── graph.rs
│ └── main.rs
├── symbol.fbs
└── type.fbs
/.github/workflows/CI.yaml:
--------------------------------------------------------------------------------
1 | name: "CI"
2 | on:
3 | push:
4 | pull_request:
5 |
6 | jobs:
7 | test:
8 | name: cargo test
9 | runs-on: ${{ matrix.os }}
10 | strategy:
11 | matrix:
12 | os: [ ubuntu-latest, windows-latest, macos-latest ]
13 | steps:
14 | - uses: actions/checkout@v4
15 | - uses: actions-rust-lang/setup-rust-toolchain@v1
16 | - run: cargo test
17 |
18 | # Check formatting with rustfmt
19 | formatting:
20 | name: cargo fmt
21 | runs-on: ubuntu-latest
22 | steps:
23 | - uses: actions/checkout@v4
24 | # Ensure rustfmt is installed and setup problem matcher
25 | - uses: actions-rust-lang/setup-rust-toolchain@v1
26 | with:
27 | components: rustfmt
28 | - name: Rustfmt Check
29 | uses: actions-rust-lang/rustfmt@v1
30 |
31 | # Check licensing and produce a list of licenses
32 | licensing:
33 | runs-on: ubuntu-latest
34 | steps:
35 | - uses: actions/checkout@v4
36 | - name: Install cargo-about
37 | uses: baptiste0928/cargo-install@v3
38 | with:
39 | crate: cargo-about
40 | version: "0.6.4"
41 | - name: Run license check
42 | run: cargo about generate about.hbs > license.html
43 | - name: Archive license file
44 | uses: actions/upload-artifact@v4
45 | with:
46 | name: license
47 | path: license.html
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Binaries for programs and dependencies
2 | /target/
3 | **/target/
4 |
5 | # Remove Cargo.lock from gitignore if it's already checked in
6 | Cargo.lock
7 |
8 | # Best practice for something like this, the python scripts are not meant to be "deployed" from this repo state.
9 | poetry.lock
10 |
11 | # These are backup files generated by rustfmt
12 | **/*.rs.bk
13 |
14 | # Temporary files generated by editors
15 | *~
16 | *.swp
17 | *.swo
18 |
19 | # IntelliJ and CLion directories
20 | .idea/
21 | *.iml
22 | *.iws
23 | *.ipr
24 |
25 | # MacOS specific ignores
26 | .DS_Store
27 | ._*
28 |
29 | # Rust documentations
30 | /target/doc/
31 |
32 | # Build files
33 | **/build/
34 |
35 | # Generated files and directories
36 | generated/
37 |
38 | # Node.js directories (if any)
39 | /node_modules/
40 |
41 | # Logs
42 | *.log
43 |
44 | # Output directories
45 | *.out
46 | *.log.*
47 |
48 | **/[Tt]humbs.db
49 | **/[Dd]esktop.ini
50 |
51 | **/ubuntu
52 | **/downloads
53 | **/msvc
54 | **/windows
55 |
56 | **/out
57 |
58 | *.vsix
59 | *.deb
--------------------------------------------------------------------------------
/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "warp"
3 | version = "0.1.0"
4 | edition = "2021"
5 | license = "Apache-2.0"
6 |
7 | [lib]
8 | path = "rust/lib.rs"
9 |
10 | [dependencies]
11 | flatbuffers = "24.3.25"
12 | bon = "2.3.0"
13 | uuid = { version = "1.11.0", features = ["v5"]}
14 | rand = "0.8.5"
15 | flate2 = "1.0.34"
16 |
17 | [features]
18 | default = []
19 | gen_flatbuffers = ["dep:flatbuffers-build"]
20 |
21 | [dev-dependencies]
22 | criterion = "0.5.1"
23 |
24 | [build-dependencies]
25 | flatbuffers-build = { git = "https://github.com/emesare/flatbuffers-build", features = ["vendored"], optional = true }
26 |
27 | [profile.release]
28 | panic = "abort"
29 | lto = true
30 | debug = "full"
31 |
32 | [profile.bench]
33 | lto = true
34 |
35 | [[example]]
36 | name = "simple"
37 | path = "rust/examples/simple.rs"
38 |
39 | [[bench]]
40 | name = "void"
41 | path = "rust/benches/void.rs"
42 | harness = false
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2020-2024 Vector 35 Inc.
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # WARP
2 |
3 | **WARP** provides a common format for transferring and applying function information across binary analysis tools.
4 |
5 | ## WARP Integrations
6 |
7 | ### Binary Ninja
8 |
9 | WARP integration is available as an [open source](https://github.com/Vector35/binaryninja-api/tree/dev/plugins/warp) first-party plugin for [Binary Ninja] and as such ships by default.
10 |
11 | ## Function Identification
12 |
13 | Function identification is the main way to interact with **WARP**, allowing tooling to utilize **WARP**'s dataset to identify
14 | common functions within any binary efficiently and accurately.
15 |
16 | ### Integration Requirements
17 |
18 | To integrate with **WARP** function matching you must be able to:
19 |
20 | 1. Disassemble instructions
21 | 2. Identify basic blocks that make up a function
22 | 3. Identify register groups with implicit extend operation
23 | 4. Identify relocatable instructions (see [What is considered a relocatable operand?](#what-is-considered-a-relocatable-operand))
24 |
25 | ### Creating a Function GUID
26 |
27 | The function GUID is the UUIDv5 of the basic block GUID's (sorted highest to lowest start address) that make up the function.
28 |
29 | #### Example
30 |
31 | Given the following sorted basic blocks:
32 |
33 | 1. `036cccf0-8239-5b84-a811-60efc2d7eeb0`
34 | 2. `3ed5c023-658d-5511-9710-40814f31af50`
35 | 3. `8a076c92-0ba0-540d-b724-7fd5838da9df`
36 |
37 | The function GUID will be `7a55be03-76b7-5cb5-bae9-4edcf47795ac`.
38 |
39 | ##### Example Code
40 |
41 | ```py
42 | import uuid
43 |
44 | def uuid5(namespace, name_bytes):
45 | """Generate a UUID from the SHA-1 hash of a namespace UUID and a name bytes."""
46 | from hashlib import sha1
47 | hash = sha1(namespace.bytes + name_bytes).digest()
48 | return uuid.UUID(bytes=hash[:16], version=5)
49 |
50 | function_namespace = uuid.UUID('0192a179-61ac-7cef-88ed-012296e9492f')
51 | bb1 = uuid.UUID("036cccf0-8239-5b84-a811-60efc2d7eeb0")
52 | bb2 = uuid.UUID("3ed5c023-658d-5511-9710-40814f31af50")
53 | bb3 = uuid.UUID("8a076c92-0ba0-540d-b724-7fd5838da9df")
54 | function = uuid5(function_namespace, bb1.bytes + bb2.bytes + bb3.bytes)
55 | ```
56 |
57 | #### What is the UUIDv5 namespace?
58 |
59 | The namespace for Function GUID's is `0192a179-61ac-7cef-88ed-012296e9492f`.
60 |
61 | ### Creating a Basic Block GUID
62 |
63 | The basic block GUID is the UUIDv5 of the byte sequence of the instructions (sorted in execution order) with the following properties:
64 |
65 | 1. Zero out all instructions containing a relocatable operand.
66 | 2. Exclude all NOP instructions.
67 | 3. Exclude all instructions that set a register to itself if they are effectively NOPs.
68 |
69 | #### When are instructions that set a register to itself removed?
70 |
71 | To support hot-patching we must remove them as they can be injected by the compiler at the start of a function (see: [1] and [2]).
72 | This does not affect the accuracy of the function GUID as they are only removed when the instruction is a NOP:
73 |
74 | - Register groups with no implicit extension will be removed (see: [3] (under 3.4.1.1))
75 |
76 | For the `x86_64` architecture this means `mov edi, edi` will _not_ be removed, but it _will_ be removed for the `x86` architecture.
77 |
78 | #### What is considered a relocatable operand?
79 |
80 | An operand that is used as a pointer to a mapped region.
81 |
82 | For the `x86` architecture the instruction `e8b55b0100` (or `call 0x15bba`) would be zeroed.
83 |
84 | #### What is the UUIDv5 namespace?
85 |
86 | The namespace for Basic Block GUID's is `0192a178-7a5f-7936-8653-3cbaa7d6afe7`.
87 |
88 | ### Function Constraints
89 |
90 | Function constraints allow us to further disambiguate between functions with the same GUID, when creating the functions we store information about the following:
91 |
92 | - Called functions
93 | - Caller functions
94 | - Adjacent functions
95 |
96 | Each entry in the lists above is referred to as a "constraint" that can be used to further reduce the number of matches for a given function GUID.
97 |
98 | ##### Why don't we require matching on constraints for trivial functions?
99 |
100 | The decision to match on constraints is left to the user. While requiring constraint matching for functions
101 | from all datasets can reduce false positives, it may not always be necessary. For example, when transferring functions
102 | from one version of a binary to another version of the same binary, not matching on constraints for trivial functions
103 | might be acceptable.
104 |
105 | ## Comparison of Function Recognition Tools
106 |
107 | ### WARP vs FLIRT
108 |
109 | The main difference between **WARP** and **FLIRT** is the approach to identification.
110 |
111 | #### Function Identification
112 |
113 | - **WARP** the function identification is described [here](#function-identification).
114 | - **FLIRT** uses incomplete function byte sequence with a mask where there is a single function entry (see: [IDA FLIRT Documentation] for a full description).
115 |
116 | What this means in practice is **WARP** will have less false positives based solely off the initial function identification.
117 | When the returned set of functions is greater than one, we can use the list of [Function Constraints](#function-constraints) to select the best possible match.
118 | However, that comes at the cost of requiring a computed GUID to be created whenever the lookup is requested and that the function GUID is _**always**_ the same.
119 |
120 |
121 | [1]: https://devblogs.microsoft.com/oldnewthing/20110921-00/?p=9583
122 | [2]: https://devblogs.microsoft.com/oldnewthing/20221109-00/?p=107373
123 | [3]: https://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-vol-1-manual.pdf
124 | [IDA FLIRT Documentation]: https://docs.hex-rays.com/user-guide/signatures/flirt/ida-f.l.i.r.t.-technology-in-depth
125 | [Binary Ninja]: https://binary.ninja
126 | [Binary Ninja Integration]: https://github.com/Vector35/binaryninja-api/tree/dev/plugins/warp
--------------------------------------------------------------------------------
/about.hbs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
37 | Third Party Licenses
38 |
39 |
40 |
41 |
42 |
43 |
Third Party Licenses
44 |
This page lists the licenses of the projects used in warp.
45 |
46 |
47 | Overview of licenses:
48 |
49 | {{#each overview}}
50 | - {{name}} ({{count}})
51 | {{/each}}
52 |
53 |
54 | All license text:
55 |
56 | {{#each licenses}}
57 | -
58 |
{{name}}
59 | Used by:
60 |
65 | {{text}}
66 |
67 | {{/each}}
68 |
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/about.toml:
--------------------------------------------------------------------------------
1 | # Used in conjuction with `cargo-about` to generate a list of licenses.
2 | accepted = [
3 | "Apache-2.0",
4 | "MIT",
5 | "Unicode-DFS-2016",
6 | "OFL-1.1",
7 | "BSL-1.0",
8 | "BSD-3-Clause",
9 | "BSD-2-Clause",
10 | "LicenseRef-UFL-1.0",
11 | "NOASSERTION",
12 | "ISC",
13 | "Zlib",
14 | "OpenSSL"
15 | ]
--------------------------------------------------------------------------------
/build.rs:
--------------------------------------------------------------------------------
1 | #[cfg(not(feature = "gen_flatbuffers"))]
2 | pub fn main() {}
3 |
4 | #[cfg(feature = "gen_flatbuffers")]
5 | pub fn main() {
6 | use flatbuffers_build::BuilderOptions;
7 | use std::path::PathBuf;
8 |
9 | // Remove leftover symlink dir.
10 | let _ = std::fs::remove_dir_all("rust/gen_flatbuffers");
11 | let workspace_dir: PathBuf = std::env::var("CARGO_MANIFEST_DIR").unwrap().into();
12 | BuilderOptions::new_with_files([
13 | workspace_dir.join("type.fbs"),
14 | workspace_dir.join("symbol.fbs"),
15 | workspace_dir.join("signature.fbs"),
16 | ])
17 | .set_output_path("rust/gen_flatbuffers")
18 | .compile()
19 | .expect("flatbuffer compilation failed");
20 | }
21 |
--------------------------------------------------------------------------------
/rust/benches/void.rs:
--------------------------------------------------------------------------------
1 | use criterion::{criterion_group, criterion_main, Criterion};
2 | use warp::r#type::class::TypeClass;
3 | use warp::r#type::guid::TypeGUID;
4 | use warp::r#type::Type;
5 |
6 | pub fn void_benchmark(c: &mut Criterion) {
7 | let void_type = Type::builder()
8 | .name("my_void".to_owned())
9 | .class(TypeClass::Void)
10 | .build();
11 |
12 | c.bench_function("uuid void", |b| {
13 | b.iter(|| {
14 | let _ = TypeGUID::from(&void_type);
15 | })
16 | });
17 |
18 | c.bench_function("computed void", |b| b.iter(|| void_type.to_bytes()));
19 | }
20 |
21 | criterion_group!(benches, void_benchmark);
22 | criterion_main!(benches);
23 |
--------------------------------------------------------------------------------
/rust/examples/simple.rs:
--------------------------------------------------------------------------------
1 | use warp::r#type::class::{
2 | ArrayClass, BooleanClass, EnumerationClass, EnumerationMember, FunctionClass, FunctionMember,
3 | IntegerClass, PointerClass, StructureClass, StructureMember, TypeClass, UnionClass,
4 | UnionMember,
5 | };
6 | use warp::r#type::Type;
7 |
8 | fn main() {
9 | let void_type = Type::builder()
10 | .name("my_void".to_owned())
11 | .class(TypeClass::Void)
12 | .build();
13 | dbg!(&void_type);
14 |
15 | let bool_class = BooleanClass::builder().width(8).build();
16 | let bool_type = Type::builder()
17 | .name("my_bool".to_owned())
18 | .class(bool_class)
19 | .build();
20 | dbg!(&bool_type);
21 |
22 | let int_class = IntegerClass::builder().width(8).signed(false).build();
23 | let int_type = Type::builder()
24 | .name("my_int".to_owned())
25 | .class(int_class)
26 | .build();
27 | dbg!(&int_type);
28 |
29 | let ptr_class = PointerClass::builder()
30 | .width(8)
31 | .child_type(void_type.clone())
32 | .build();
33 | let ptr_type = Type::builder()
34 | .name("my_ptr".to_owned())
35 | .class(ptr_class)
36 | .build();
37 | dbg!(&ptr_type);
38 |
39 | let array_class = ArrayClass::builder()
40 | .length(4)
41 | .member_type(void_type.clone())
42 | .build();
43 | let array_type = Type::builder()
44 | .name("my_array".to_owned())
45 | .class(array_class)
46 | .build();
47 | dbg!(&array_type);
48 |
49 | let enum_class = EnumerationClass::new(
50 | int_type.clone(),
51 | vec![
52 | EnumerationMember::builder().name("one").constant(1).build(),
53 | EnumerationMember::builder().name("two").constant(2).build(),
54 | EnumerationMember::builder()
55 | .name("five")
56 | .constant(5)
57 | .build(),
58 | EnumerationMember::builder().constant(6).build(),
59 | ],
60 | );
61 | let enum_type = Type::builder()
62 | .name("my_enum".to_owned())
63 | .class(enum_class)
64 | .build();
65 | dbg!(&enum_type);
66 |
67 | let union_class = UnionClass::new(vec![
68 | UnionMember::new("int".to_owned(), int_type.clone()),
69 | UnionMember::new("bool".to_owned(), bool_type.clone()),
70 | UnionMember::new("ptr".to_owned(), ptr_type.clone()),
71 | UnionMember::new("enum".to_owned(), enum_type.clone()),
72 | UnionMember::new("array".to_owned(), array_type.clone()),
73 | ]);
74 | let union_type = Type::builder()
75 | .name("my_union".to_owned())
76 | .class(union_class)
77 | .build();
78 | dbg!(&union_type);
79 |
80 | let struct_class = StructureClass::new(vec![
81 | StructureMember::builder()
82 | .name("int")
83 | .ty(int_type.clone())
84 | .offset(0)
85 | .build(),
86 | StructureMember::builder()
87 | .name("bool")
88 | .ty(bool_type.clone())
89 | .offset(64)
90 | .build(),
91 | StructureMember::builder()
92 | .name("pointer")
93 | .ty(ptr_type.clone())
94 | .offset(72)
95 | .build(),
96 | StructureMember::builder()
97 | .name("enum")
98 | .ty(enum_type.clone())
99 | .offset(136)
100 | .build(),
101 | StructureMember::builder()
102 | .name("array")
103 | .ty(array_type.clone())
104 | .offset(200)
105 | .build(),
106 | ]);
107 | let struct_type = Type::builder()
108 | .name("my_struct".to_owned())
109 | .class(struct_class)
110 | .build();
111 | dbg!(&struct_type);
112 |
113 | let func_class = FunctionClass::new(
114 | None,
115 | vec![
116 | FunctionMember::builder()
117 | .name("param_0")
118 | .ty(int_type.clone())
119 | .build(),
120 | FunctionMember::builder()
121 | .name("param_1")
122 | .ty(bool_type.clone())
123 | .build(),
124 | ],
125 | vec![],
126 | );
127 | let func_type = Type::builder()
128 | .name("my_func".to_owned())
129 | .class(func_class)
130 | .build();
131 | dbg!(&func_type);
132 | }
133 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/mod.rs:
--------------------------------------------------------------------------------
1 | // Automatically generated by the Flatbuffers compiler. Do not modify.
2 | // @generated
3 | pub mod sig_bin {
4 | use super::*;
5 | mod basic_block_generated;
6 | pub use self::basic_block_generated::*;
7 | mod function_constraint_generated;
8 | pub use self::function_constraint_generated::*;
9 | mod function_constraints_generated;
10 | pub use self::function_constraints_generated::*;
11 | mod function_generated;
12 | pub use self::function_generated::*;
13 | mod data_generated;
14 | pub use self::data_generated::*;
15 | } // sig_bin
16 | pub mod symbol_bin {
17 | use super::*;
18 | mod symbol_class_generated;
19 | pub use self::symbol_class_generated::*;
20 | mod symbol_modifiers_generated;
21 | pub use self::symbol_modifiers_generated::*;
22 | mod function_symbol_class_generated;
23 | pub use self::function_symbol_class_generated::*;
24 | mod data_symbol_class_generated;
25 | pub use self::data_symbol_class_generated::*;
26 | mod symbol_generated;
27 | pub use self::symbol_generated::*;
28 | } // symbol_bin
29 | pub mod type_bin {
30 | use super::*;
31 | mod type_modifier_class_generated;
32 | pub use self::type_modifier_class_generated::*;
33 | mod type_alignment_generated;
34 | pub use self::type_alignment_generated::*;
35 | mod pointer_addressing_generated;
36 | pub use self::pointer_addressing_generated::*;
37 | mod array_modifiers_generated;
38 | pub use self::array_modifiers_generated::*;
39 | mod structure_member_modifiers_generated;
40 | pub use self::structure_member_modifiers_generated::*;
41 | mod location_class_generated;
42 | pub use self::location_class_generated::*;
43 | mod type_class_generated;
44 | pub use self::type_class_generated::*;
45 | mod unsigned_bit_offset_generated;
46 | pub use self::unsigned_bit_offset_generated::*;
47 | mod bit_offset_generated;
48 | pub use self::bit_offset_generated::*;
49 | mod bit_shift_generated;
50 | pub use self::bit_shift_generated::*;
51 | mod bit_size_generated;
52 | pub use self::bit_size_generated::*;
53 | mod bit_width_generated;
54 | pub use self::bit_width_generated::*;
55 | mod constant_modifier_class_generated;
56 | pub use self::constant_modifier_class_generated::*;
57 | mod volatile_modifier_class_generated;
58 | pub use self::volatile_modifier_class_generated::*;
59 | mod descriptor_modifier_class_generated;
60 | pub use self::descriptor_modifier_class_generated::*;
61 | mod metadata_modifier_class_generated;
62 | pub use self::metadata_modifier_class_generated::*;
63 | mod type_modifier_generated;
64 | pub use self::type_modifier_generated::*;
65 | mod access_alignment_generated;
66 | pub use self::access_alignment_generated::*;
67 | mod fixed_alignment_generated;
68 | pub use self::fixed_alignment_generated::*;
69 | mod void_generated;
70 | pub use self::void_generated::*;
71 | mod boolean_generated;
72 | pub use self::boolean_generated::*;
73 | mod float_generated;
74 | pub use self::float_generated::*;
75 | mod character_generated;
76 | pub use self::character_generated::*;
77 | mod integer_generated;
78 | pub use self::integer_generated::*;
79 | mod pointer_generated;
80 | pub use self::pointer_generated::*;
81 | mod array_generated;
82 | pub use self::array_generated::*;
83 | mod structure_member_generated;
84 | pub use self::structure_member_generated::*;
85 | mod structure_generated;
86 | pub use self::structure_generated::*;
87 | mod enumeration_member_generated;
88 | pub use self::enumeration_member_generated::*;
89 | mod enumeration_generated;
90 | pub use self::enumeration_generated::*;
91 | mod union_member_generated;
92 | pub use self::union_member_generated::*;
93 | mod union_generated;
94 | pub use self::union_generated::*;
95 | mod calling_convention_generated;
96 | pub use self::calling_convention_generated::*;
97 | mod register_location_generated;
98 | pub use self::register_location_generated::*;
99 | mod stack_location_generated;
100 | pub use self::stack_location_generated::*;
101 | mod function_member_location_generated;
102 | pub use self::function_member_location_generated::*;
103 | mod function_member_generated;
104 | pub use self::function_member_generated::*;
105 | mod function_generated;
106 | pub use self::function_generated::*;
107 | mod referrer_generated;
108 | pub use self::referrer_generated::*;
109 | mod type_generated;
110 | pub use self::type_generated::*;
111 | mod computed_type_generated;
112 | pub use self::computed_type_generated::*;
113 | mod data_generated;
114 | pub use self::data_generated::*;
115 | } // type_bin
116 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/sig_bin/basic_block_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | pub enum BasicBlockOffset {}
13 | #[derive(Copy, Clone, PartialEq)]
14 |
15 | pub struct BasicBlock<'a> {
16 | pub _tab: flatbuffers::Table<'a>,
17 | }
18 |
19 | impl<'a> flatbuffers::Follow<'a> for BasicBlock<'a> {
20 | type Inner = BasicBlock<'a>;
21 | #[inline]
22 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
23 | Self { _tab: flatbuffers::Table::new(buf, loc) }
24 | }
25 | }
26 |
27 | impl<'a> BasicBlock<'a> {
28 | pub const VT_GUID: flatbuffers::VOffsetT = 4;
29 |
30 | #[inline]
31 | pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
32 | BasicBlock { _tab: table }
33 | }
34 | #[allow(unused_mut)]
35 | pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
36 | _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
37 | args: &'args BasicBlockArgs<'args>
38 | ) -> flatbuffers::WIPOffset> {
39 | let mut builder = BasicBlockBuilder::new(_fbb);
40 | if let Some(x) = args.guid { builder.add_guid(x); }
41 | builder.finish()
42 | }
43 |
44 |
45 | #[inline]
46 | pub fn guid(&self) -> &'a str {
47 | // Safety:
48 | // Created from valid Table for this object
49 | // which contains a valid value in this slot
50 | unsafe { self._tab.get::>(BasicBlock::VT_GUID, None).unwrap()}
51 | }
52 | }
53 |
54 | impl flatbuffers::Verifiable for BasicBlock<'_> {
55 | #[inline]
56 | fn run_verifier(
57 | v: &mut flatbuffers::Verifier, pos: usize
58 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
59 | use self::flatbuffers::Verifiable;
60 | v.visit_table(pos)?
61 | .visit_field::>("guid", Self::VT_GUID, true)?
62 | .finish();
63 | Ok(())
64 | }
65 | }
66 | pub struct BasicBlockArgs<'a> {
67 | pub guid: Option>,
68 | }
69 | impl<'a> Default for BasicBlockArgs<'a> {
70 | #[inline]
71 | fn default() -> Self {
72 | BasicBlockArgs {
73 | guid: None, // required field
74 | }
75 | }
76 | }
77 |
78 | pub struct BasicBlockBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
79 | fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
80 | start_: flatbuffers::WIPOffset,
81 | }
82 | impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> BasicBlockBuilder<'a, 'b, A> {
83 | #[inline]
84 | pub fn add_guid(&mut self, guid: flatbuffers::WIPOffset<&'b str>) {
85 | self.fbb_.push_slot_always::>(BasicBlock::VT_GUID, guid);
86 | }
87 | #[inline]
88 | pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> BasicBlockBuilder<'a, 'b, A> {
89 | let start = _fbb.start_table();
90 | BasicBlockBuilder {
91 | fbb_: _fbb,
92 | start_: start,
93 | }
94 | }
95 | #[inline]
96 | pub fn finish(self) -> flatbuffers::WIPOffset> {
97 | let o = self.fbb_.end_table(self.start_);
98 | self.fbb_.required(o, BasicBlock::VT_GUID,"guid");
99 | flatbuffers::WIPOffset::new(o.value())
100 | }
101 | }
102 |
103 | impl core::fmt::Debug for BasicBlock<'_> {
104 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
105 | let mut ds = f.debug_struct("BasicBlock");
106 | ds.field("guid", &self.guid());
107 | ds.finish()
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/sig_bin/function_constraint_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | pub enum FunctionConstraintOffset {}
13 | #[derive(Copy, Clone, PartialEq)]
14 |
15 | pub struct FunctionConstraint<'a> {
16 | pub _tab: flatbuffers::Table<'a>,
17 | }
18 |
19 | impl<'a> flatbuffers::Follow<'a> for FunctionConstraint<'a> {
20 | type Inner = FunctionConstraint<'a>;
21 | #[inline]
22 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
23 | Self { _tab: flatbuffers::Table::new(buf, loc) }
24 | }
25 | }
26 |
27 | impl<'a> FunctionConstraint<'a> {
28 | pub const VT_GUID: flatbuffers::VOffsetT = 4;
29 | pub const VT_SYMBOL: flatbuffers::VOffsetT = 6;
30 | pub const VT_OFFSET: flatbuffers::VOffsetT = 8;
31 |
32 | #[inline]
33 | pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
34 | FunctionConstraint { _tab: table }
35 | }
36 | #[allow(unused_mut)]
37 | pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
38 | _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
39 | args: &'args FunctionConstraintArgs<'args>
40 | ) -> flatbuffers::WIPOffset> {
41 | let mut builder = FunctionConstraintBuilder::new(_fbb);
42 | builder.add_offset(args.offset);
43 | if let Some(x) = args.symbol { builder.add_symbol(x); }
44 | if let Some(x) = args.guid { builder.add_guid(x); }
45 | builder.finish()
46 | }
47 |
48 |
49 | #[inline]
50 | pub fn guid(&self) -> Option<&'a str> {
51 | // Safety:
52 | // Created from valid Table for this object
53 | // which contains a valid value in this slot
54 | unsafe { self._tab.get::>(FunctionConstraint::VT_GUID, None)}
55 | }
56 | #[inline]
57 | pub fn symbol(&self) -> Option> {
58 | // Safety:
59 | // Created from valid Table for this object
60 | // which contains a valid value in this slot
61 | unsafe { self._tab.get::>(FunctionConstraint::VT_SYMBOL, None)}
62 | }
63 | #[inline]
64 | pub fn offset(&self) -> i64 {
65 | // Safety:
66 | // Created from valid Table for this object
67 | // which contains a valid value in this slot
68 | unsafe { self._tab.get::(FunctionConstraint::VT_OFFSET, Some(0)).unwrap()}
69 | }
70 | }
71 |
72 | impl flatbuffers::Verifiable for FunctionConstraint<'_> {
73 | #[inline]
74 | fn run_verifier(
75 | v: &mut flatbuffers::Verifier, pos: usize
76 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
77 | use self::flatbuffers::Verifiable;
78 | v.visit_table(pos)?
79 | .visit_field::>("guid", Self::VT_GUID, false)?
80 | .visit_field::>("symbol", Self::VT_SYMBOL, false)?
81 | .visit_field::("offset", Self::VT_OFFSET, false)?
82 | .finish();
83 | Ok(())
84 | }
85 | }
86 | pub struct FunctionConstraintArgs<'a> {
87 | pub guid: Option>,
88 | pub symbol: Option>>,
89 | pub offset: i64,
90 | }
91 | impl<'a> Default for FunctionConstraintArgs<'a> {
92 | #[inline]
93 | fn default() -> Self {
94 | FunctionConstraintArgs {
95 | guid: None,
96 | symbol: None,
97 | offset: 0,
98 | }
99 | }
100 | }
101 |
102 | pub struct FunctionConstraintBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
103 | fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
104 | start_: flatbuffers::WIPOffset,
105 | }
106 | impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> FunctionConstraintBuilder<'a, 'b, A> {
107 | #[inline]
108 | pub fn add_guid(&mut self, guid: flatbuffers::WIPOffset<&'b str>) {
109 | self.fbb_.push_slot_always::>(FunctionConstraint::VT_GUID, guid);
110 | }
111 | #[inline]
112 | pub fn add_symbol(&mut self, symbol: flatbuffers::WIPOffset>) {
113 | self.fbb_.push_slot_always::>(FunctionConstraint::VT_SYMBOL, symbol);
114 | }
115 | #[inline]
116 | pub fn add_offset(&mut self, offset: i64) {
117 | self.fbb_.push_slot::(FunctionConstraint::VT_OFFSET, offset, 0);
118 | }
119 | #[inline]
120 | pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> FunctionConstraintBuilder<'a, 'b, A> {
121 | let start = _fbb.start_table();
122 | FunctionConstraintBuilder {
123 | fbb_: _fbb,
124 | start_: start,
125 | }
126 | }
127 | #[inline]
128 | pub fn finish(self) -> flatbuffers::WIPOffset> {
129 | let o = self.fbb_.end_table(self.start_);
130 | flatbuffers::WIPOffset::new(o.value())
131 | }
132 | }
133 |
134 | impl core::fmt::Debug for FunctionConstraint<'_> {
135 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
136 | let mut ds = f.debug_struct("FunctionConstraint");
137 | ds.field("guid", &self.guid());
138 | ds.field("symbol", &self.symbol());
139 | ds.field("offset", &self.offset());
140 | ds.finish()
141 | }
142 | }
143 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/symbol_bin/data_symbol_class_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | pub enum DataSymbolClassOffset {}
13 | #[derive(Copy, Clone, PartialEq)]
14 |
15 | pub struct DataSymbolClass<'a> {
16 | pub _tab: flatbuffers::Table<'a>,
17 | }
18 |
19 | impl<'a> flatbuffers::Follow<'a> for DataSymbolClass<'a> {
20 | type Inner = DataSymbolClass<'a>;
21 | #[inline]
22 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
23 | Self { _tab: flatbuffers::Table::new(buf, loc) }
24 | }
25 | }
26 |
27 | impl<'a> DataSymbolClass<'a> {
28 |
29 | #[inline]
30 | pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
31 | DataSymbolClass { _tab: table }
32 | }
33 | #[allow(unused_mut)]
34 | pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
35 | _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
36 | _args: &'args DataSymbolClassArgs
37 | ) -> flatbuffers::WIPOffset> {
38 | let mut builder = DataSymbolClassBuilder::new(_fbb);
39 | builder.finish()
40 | }
41 |
42 | }
43 |
44 | impl flatbuffers::Verifiable for DataSymbolClass<'_> {
45 | #[inline]
46 | fn run_verifier(
47 | v: &mut flatbuffers::Verifier, pos: usize
48 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
49 | use self::flatbuffers::Verifiable;
50 | v.visit_table(pos)?
51 | .finish();
52 | Ok(())
53 | }
54 | }
55 | pub struct DataSymbolClassArgs {
56 | }
57 | impl<'a> Default for DataSymbolClassArgs {
58 | #[inline]
59 | fn default() -> Self {
60 | DataSymbolClassArgs {
61 | }
62 | }
63 | }
64 |
65 | pub struct DataSymbolClassBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
66 | fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
67 | start_: flatbuffers::WIPOffset,
68 | }
69 | impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DataSymbolClassBuilder<'a, 'b, A> {
70 | #[inline]
71 | pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DataSymbolClassBuilder<'a, 'b, A> {
72 | let start = _fbb.start_table();
73 | DataSymbolClassBuilder {
74 | fbb_: _fbb,
75 | start_: start,
76 | }
77 | }
78 | #[inline]
79 | pub fn finish(self) -> flatbuffers::WIPOffset> {
80 | let o = self.fbb_.end_table(self.start_);
81 | flatbuffers::WIPOffset::new(o.value())
82 | }
83 | }
84 |
85 | impl core::fmt::Debug for DataSymbolClass<'_> {
86 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
87 | let mut ds = f.debug_struct("DataSymbolClass");
88 | ds.finish()
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/symbol_bin/function_symbol_class_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | pub enum FunctionSymbolClassOffset {}
13 | #[derive(Copy, Clone, PartialEq)]
14 |
15 | pub struct FunctionSymbolClass<'a> {
16 | pub _tab: flatbuffers::Table<'a>,
17 | }
18 |
19 | impl<'a> flatbuffers::Follow<'a> for FunctionSymbolClass<'a> {
20 | type Inner = FunctionSymbolClass<'a>;
21 | #[inline]
22 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
23 | Self { _tab: flatbuffers::Table::new(buf, loc) }
24 | }
25 | }
26 |
27 | impl<'a> FunctionSymbolClass<'a> {
28 |
29 | #[inline]
30 | pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
31 | FunctionSymbolClass { _tab: table }
32 | }
33 | #[allow(unused_mut)]
34 | pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
35 | _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
36 | _args: &'args FunctionSymbolClassArgs
37 | ) -> flatbuffers::WIPOffset> {
38 | let mut builder = FunctionSymbolClassBuilder::new(_fbb);
39 | builder.finish()
40 | }
41 |
42 | }
43 |
44 | impl flatbuffers::Verifiable for FunctionSymbolClass<'_> {
45 | #[inline]
46 | fn run_verifier(
47 | v: &mut flatbuffers::Verifier, pos: usize
48 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
49 | use self::flatbuffers::Verifiable;
50 | v.visit_table(pos)?
51 | .finish();
52 | Ok(())
53 | }
54 | }
55 | pub struct FunctionSymbolClassArgs {
56 | }
57 | impl<'a> Default for FunctionSymbolClassArgs {
58 | #[inline]
59 | fn default() -> Self {
60 | FunctionSymbolClassArgs {
61 | }
62 | }
63 | }
64 |
65 | pub struct FunctionSymbolClassBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
66 | fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
67 | start_: flatbuffers::WIPOffset,
68 | }
69 | impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> FunctionSymbolClassBuilder<'a, 'b, A> {
70 | #[inline]
71 | pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> FunctionSymbolClassBuilder<'a, 'b, A> {
72 | let start = _fbb.start_table();
73 | FunctionSymbolClassBuilder {
74 | fbb_: _fbb,
75 | start_: start,
76 | }
77 | }
78 | #[inline]
79 | pub fn finish(self) -> flatbuffers::WIPOffset> {
80 | let o = self.fbb_.end_table(self.start_);
81 | flatbuffers::WIPOffset::new(o.value())
82 | }
83 | }
84 |
85 | impl core::fmt::Debug for FunctionSymbolClass<'_> {
86 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
87 | let mut ds = f.debug_struct("FunctionSymbolClass");
88 | ds.finish()
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/symbol_bin/symbol_class_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
13 | pub const ENUM_MIN_SYMBOL_CLASS: u8 = 0;
14 | #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
15 | pub const ENUM_MAX_SYMBOL_CLASS: u8 = 2;
16 | #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
17 | #[allow(non_camel_case_types)]
18 | pub const ENUM_VALUES_SYMBOL_CLASS: [SymbolClass; 3] = [
19 | SymbolClass::NONE,
20 | SymbolClass::FunctionSymbolClass,
21 | SymbolClass::DataSymbolClass,
22 | ];
23 |
24 | #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
25 | #[repr(transparent)]
26 | pub struct SymbolClass(pub u8);
27 | #[allow(non_upper_case_globals)]
28 | impl SymbolClass {
29 | pub const NONE: Self = Self(0);
30 | pub const FunctionSymbolClass: Self = Self(1);
31 | pub const DataSymbolClass: Self = Self(2);
32 |
33 | pub const ENUM_MIN: u8 = 0;
34 | pub const ENUM_MAX: u8 = 2;
35 | pub const ENUM_VALUES: &'static [Self] = &[
36 | Self::NONE,
37 | Self::FunctionSymbolClass,
38 | Self::DataSymbolClass,
39 | ];
40 | /// Returns the variant's name or "" if unknown.
41 | pub fn variant_name(self) -> Option<&'static str> {
42 | match self {
43 | Self::NONE => Some("NONE"),
44 | Self::FunctionSymbolClass => Some("FunctionSymbolClass"),
45 | Self::DataSymbolClass => Some("DataSymbolClass"),
46 | _ => None,
47 | }
48 | }
49 | }
50 | impl core::fmt::Debug for SymbolClass {
51 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
52 | if let Some(name) = self.variant_name() {
53 | f.write_str(name)
54 | } else {
55 | f.write_fmt(format_args!("", self.0))
56 | }
57 | }
58 | }
59 | impl<'a> flatbuffers::Follow<'a> for SymbolClass {
60 | type Inner = Self;
61 | #[inline]
62 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
63 | let b = flatbuffers::read_scalar_at::(buf, loc);
64 | Self(b)
65 | }
66 | }
67 |
68 | impl flatbuffers::Push for SymbolClass {
69 | type Output = SymbolClass;
70 | #[inline]
71 | unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
72 | flatbuffers::emplace_scalar::(dst, self.0);
73 | }
74 | }
75 |
76 | impl flatbuffers::EndianScalar for SymbolClass {
77 | type Scalar = u8;
78 | #[inline]
79 | fn to_little_endian(self) -> u8 {
80 | self.0.to_le()
81 | }
82 | #[inline]
83 | #[allow(clippy::wrong_self_convention)]
84 | fn from_little_endian(v: u8) -> Self {
85 | let b = u8::from_le(v);
86 | Self(b)
87 | }
88 | }
89 |
90 | impl<'a> flatbuffers::Verifiable for SymbolClass {
91 | #[inline]
92 | fn run_verifier(
93 | v: &mut flatbuffers::Verifier, pos: usize
94 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
95 | use self::flatbuffers::Verifiable;
96 | u8::run_verifier(v, pos)
97 | }
98 | }
99 |
100 | impl flatbuffers::SimpleToVerifyInSlice for SymbolClass {}
101 | pub struct SymbolClassUnionTableOffset {}
102 |
103 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/symbol_bin/symbol_modifiers_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | #[allow(non_upper_case_globals)]
13 | mod bitflags_symbol_modifiers {
14 | flatbuffers::bitflags::bitflags! {
15 | #[derive(Default)]
16 | pub struct SymbolModifiers: u8 {
17 | const External = 1;
18 | const Exported = 2;
19 | }
20 | }
21 | }
22 | pub use self::bitflags_symbol_modifiers::SymbolModifiers;
23 |
24 | impl<'a> flatbuffers::Follow<'a> for SymbolModifiers {
25 | type Inner = Self;
26 | #[inline]
27 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
28 | let b = flatbuffers::read_scalar_at::(buf, loc);
29 | // Safety:
30 | // This is safe because we know bitflags is implemented with a repr transparent uint of the correct size.
31 | // from_bits_unchecked will be replaced by an equivalent but safe from_bits_retain in bitflags 2.0
32 | // https://github.com/bitflags/bitflags/issues/262
33 | Self::from_bits_unchecked(b)
34 | }
35 | }
36 |
37 | impl flatbuffers::Push for SymbolModifiers {
38 | type Output = SymbolModifiers;
39 | #[inline]
40 | unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
41 | flatbuffers::emplace_scalar::(dst, self.bits());
42 | }
43 | }
44 |
45 | impl flatbuffers::EndianScalar for SymbolModifiers {
46 | type Scalar = u8;
47 | #[inline]
48 | fn to_little_endian(self) -> u8 {
49 | self.bits().to_le()
50 | }
51 | #[inline]
52 | #[allow(clippy::wrong_self_convention)]
53 | fn from_little_endian(v: u8) -> Self {
54 | let b = u8::from_le(v);
55 | // Safety:
56 | // This is safe because we know bitflags is implemented with a repr transparent uint of the correct size.
57 | // from_bits_unchecked will be replaced by an equivalent but safe from_bits_retain in bitflags 2.0
58 | // https://github.com/bitflags/bitflags/issues/262
59 | unsafe { Self::from_bits_unchecked(b) }
60 | }
61 | }
62 |
63 | impl<'a> flatbuffers::Verifiable for SymbolModifiers {
64 | #[inline]
65 | fn run_verifier(
66 | v: &mut flatbuffers::Verifier, pos: usize
67 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
68 | use self::flatbuffers::Verifiable;
69 | u8::run_verifier(v, pos)
70 | }
71 | }
72 |
73 | impl flatbuffers::SimpleToVerifyInSlice for SymbolModifiers {}
74 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/type_bin/access_alignment_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | pub enum AccessAlignmentOffset {}
13 | #[derive(Copy, Clone, PartialEq)]
14 |
15 | pub struct AccessAlignment<'a> {
16 | pub _tab: flatbuffers::Table<'a>,
17 | }
18 |
19 | impl<'a> flatbuffers::Follow<'a> for AccessAlignment<'a> {
20 | type Inner = AccessAlignment<'a>;
21 | #[inline]
22 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
23 | Self { _tab: flatbuffers::Table::new(buf, loc) }
24 | }
25 | }
26 |
27 | impl<'a> AccessAlignment<'a> {
28 |
29 | #[inline]
30 | pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
31 | AccessAlignment { _tab: table }
32 | }
33 | #[allow(unused_mut)]
34 | pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
35 | _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
36 | _args: &'args AccessAlignmentArgs
37 | ) -> flatbuffers::WIPOffset> {
38 | let mut builder = AccessAlignmentBuilder::new(_fbb);
39 | builder.finish()
40 | }
41 |
42 | }
43 |
44 | impl flatbuffers::Verifiable for AccessAlignment<'_> {
45 | #[inline]
46 | fn run_verifier(
47 | v: &mut flatbuffers::Verifier, pos: usize
48 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
49 | use self::flatbuffers::Verifiable;
50 | v.visit_table(pos)?
51 | .finish();
52 | Ok(())
53 | }
54 | }
55 | pub struct AccessAlignmentArgs {
56 | }
57 | impl<'a> Default for AccessAlignmentArgs {
58 | #[inline]
59 | fn default() -> Self {
60 | AccessAlignmentArgs {
61 | }
62 | }
63 | }
64 |
65 | pub struct AccessAlignmentBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
66 | fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
67 | start_: flatbuffers::WIPOffset,
68 | }
69 | impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> AccessAlignmentBuilder<'a, 'b, A> {
70 | #[inline]
71 | pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> AccessAlignmentBuilder<'a, 'b, A> {
72 | let start = _fbb.start_table();
73 | AccessAlignmentBuilder {
74 | fbb_: _fbb,
75 | start_: start,
76 | }
77 | }
78 | #[inline]
79 | pub fn finish(self) -> flatbuffers::WIPOffset> {
80 | let o = self.fbb_.end_table(self.start_);
81 | flatbuffers::WIPOffset::new(o.value())
82 | }
83 | }
84 |
85 | impl core::fmt::Debug for AccessAlignment<'_> {
86 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
87 | let mut ds = f.debug_struct("AccessAlignment");
88 | ds.finish()
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/type_bin/array_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | pub enum ArrayOffset {}
13 | #[derive(Copy, Clone, PartialEq)]
14 |
15 | pub struct Array<'a> {
16 | pub _tab: flatbuffers::Table<'a>,
17 | }
18 |
19 | impl<'a> flatbuffers::Follow<'a> for Array<'a> {
20 | type Inner = Array<'a>;
21 | #[inline]
22 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
23 | Self { _tab: flatbuffers::Table::new(buf, loc) }
24 | }
25 | }
26 |
27 | impl<'a> Array<'a> {
28 | pub const VT_TYPE_: flatbuffers::VOffsetT = 4;
29 | pub const VT_LENGTH: flatbuffers::VOffsetT = 6;
30 | pub const VT_MODIFIERS: flatbuffers::VOffsetT = 8;
31 |
32 | #[inline]
33 | pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
34 | Array { _tab: table }
35 | }
36 | #[allow(unused_mut)]
37 | pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
38 | _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
39 | args: &'args ArrayArgs<'args>
40 | ) -> flatbuffers::WIPOffset> {
41 | let mut builder = ArrayBuilder::new(_fbb);
42 | builder.add_length(args.length);
43 | if let Some(x) = args.type_ { builder.add_type_(x); }
44 | builder.add_modifiers(args.modifiers);
45 | builder.finish()
46 | }
47 |
48 |
49 | #[inline]
50 | pub fn type_(&self) -> Type<'a> {
51 | // Safety:
52 | // Created from valid Table for this object
53 | // which contains a valid value in this slot
54 | unsafe { self._tab.get::>(Array::VT_TYPE_, None).unwrap()}
55 | }
56 | #[inline]
57 | pub fn length(&self) -> u64 {
58 | // Safety:
59 | // Created from valid Table for this object
60 | // which contains a valid value in this slot
61 | unsafe { self._tab.get::(Array::VT_LENGTH, Some(0)).unwrap()}
62 | }
63 | #[inline]
64 | pub fn modifiers(&self) -> ArrayModifiers {
65 | // Safety:
66 | // Created from valid Table for this object
67 | // which contains a valid value in this slot
68 | unsafe { self._tab.get::(Array::VT_MODIFIERS, Some(Default::default())).unwrap()}
69 | }
70 | }
71 |
72 | impl flatbuffers::Verifiable for Array<'_> {
73 | #[inline]
74 | fn run_verifier(
75 | v: &mut flatbuffers::Verifier, pos: usize
76 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
77 | use self::flatbuffers::Verifiable;
78 | v.visit_table(pos)?
79 | .visit_field::>("type_", Self::VT_TYPE_, true)?
80 | .visit_field::("length", Self::VT_LENGTH, false)?
81 | .visit_field::("modifiers", Self::VT_MODIFIERS, false)?
82 | .finish();
83 | Ok(())
84 | }
85 | }
86 | pub struct ArrayArgs<'a> {
87 | pub type_: Option>>,
88 | pub length: u64,
89 | pub modifiers: ArrayModifiers,
90 | }
91 | impl<'a> Default for ArrayArgs<'a> {
92 | #[inline]
93 | fn default() -> Self {
94 | ArrayArgs {
95 | type_: None, // required field
96 | length: 0,
97 | modifiers: Default::default(),
98 | }
99 | }
100 | }
101 |
102 | pub struct ArrayBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
103 | fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
104 | start_: flatbuffers::WIPOffset,
105 | }
106 | impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> ArrayBuilder<'a, 'b, A> {
107 | #[inline]
108 | pub fn add_type_(&mut self, type_: flatbuffers::WIPOffset>) {
109 | self.fbb_.push_slot_always::>(Array::VT_TYPE_, type_);
110 | }
111 | #[inline]
112 | pub fn add_length(&mut self, length: u64) {
113 | self.fbb_.push_slot::(Array::VT_LENGTH, length, 0);
114 | }
115 | #[inline]
116 | pub fn add_modifiers(&mut self, modifiers: ArrayModifiers) {
117 | self.fbb_.push_slot::(Array::VT_MODIFIERS, modifiers, Default::default());
118 | }
119 | #[inline]
120 | pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> ArrayBuilder<'a, 'b, A> {
121 | let start = _fbb.start_table();
122 | ArrayBuilder {
123 | fbb_: _fbb,
124 | start_: start,
125 | }
126 | }
127 | #[inline]
128 | pub fn finish(self) -> flatbuffers::WIPOffset> {
129 | let o = self.fbb_.end_table(self.start_);
130 | self.fbb_.required(o, Array::VT_TYPE_,"type_");
131 | flatbuffers::WIPOffset::new(o.value())
132 | }
133 | }
134 |
135 | impl core::fmt::Debug for Array<'_> {
136 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
137 | let mut ds = f.debug_struct("Array");
138 | ds.field("type_", &self.type_());
139 | ds.field("length", &self.length());
140 | ds.field("modifiers", &self.modifiers());
141 | ds.finish()
142 | }
143 | }
144 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/type_bin/array_modifiers_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | #[allow(non_upper_case_globals)]
13 | mod bitflags_array_modifiers {
14 | flatbuffers::bitflags::bitflags! {
15 | #[derive(Default)]
16 | pub struct ArrayModifiers: u8 {
17 | const NullTerminated = 1;
18 | }
19 | }
20 | }
21 | pub use self::bitflags_array_modifiers::ArrayModifiers;
22 |
23 | impl<'a> flatbuffers::Follow<'a> for ArrayModifiers {
24 | type Inner = Self;
25 | #[inline]
26 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
27 | let b = flatbuffers::read_scalar_at::(buf, loc);
28 | // Safety:
29 | // This is safe because we know bitflags is implemented with a repr transparent uint of the correct size.
30 | // from_bits_unchecked will be replaced by an equivalent but safe from_bits_retain in bitflags 2.0
31 | // https://github.com/bitflags/bitflags/issues/262
32 | Self::from_bits_unchecked(b)
33 | }
34 | }
35 |
36 | impl flatbuffers::Push for ArrayModifiers {
37 | type Output = ArrayModifiers;
38 | #[inline]
39 | unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
40 | flatbuffers::emplace_scalar::(dst, self.bits());
41 | }
42 | }
43 |
44 | impl flatbuffers::EndianScalar for ArrayModifiers {
45 | type Scalar = u8;
46 | #[inline]
47 | fn to_little_endian(self) -> u8 {
48 | self.bits().to_le()
49 | }
50 | #[inline]
51 | #[allow(clippy::wrong_self_convention)]
52 | fn from_little_endian(v: u8) -> Self {
53 | let b = u8::from_le(v);
54 | // Safety:
55 | // This is safe because we know bitflags is implemented with a repr transparent uint of the correct size.
56 | // from_bits_unchecked will be replaced by an equivalent but safe from_bits_retain in bitflags 2.0
57 | // https://github.com/bitflags/bitflags/issues/262
58 | unsafe { Self::from_bits_unchecked(b) }
59 | }
60 | }
61 |
62 | impl<'a> flatbuffers::Verifiable for ArrayModifiers {
63 | #[inline]
64 | fn run_verifier(
65 | v: &mut flatbuffers::Verifier, pos: usize
66 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
67 | use self::flatbuffers::Verifiable;
68 | u8::run_verifier(v, pos)
69 | }
70 | }
71 |
72 | impl flatbuffers::SimpleToVerifyInSlice for ArrayModifiers {}
73 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/type_bin/bit_offset_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | // struct BitOffset, aligned to 8
13 | #[repr(transparent)]
14 | #[derive(Clone, Copy, PartialEq)]
15 | pub struct BitOffset(pub [u8; 8]);
16 | impl Default for BitOffset {
17 | fn default() -> Self {
18 | Self([0; 8])
19 | }
20 | }
21 | impl core::fmt::Debug for BitOffset {
22 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
23 | f.debug_struct("BitOffset")
24 | .field("value", &self.value())
25 | .finish()
26 | }
27 | }
28 |
29 | impl flatbuffers::SimpleToVerifyInSlice for BitOffset {}
30 | impl<'a> flatbuffers::Follow<'a> for BitOffset {
31 | type Inner = &'a BitOffset;
32 | #[inline]
33 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
34 | <&'a BitOffset>::follow(buf, loc)
35 | }
36 | }
37 | impl<'a> flatbuffers::Follow<'a> for &'a BitOffset {
38 | type Inner = &'a BitOffset;
39 | #[inline]
40 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
41 | flatbuffers::follow_cast_ref::(buf, loc)
42 | }
43 | }
44 | impl<'b> flatbuffers::Push for BitOffset {
45 | type Output = BitOffset;
46 | #[inline]
47 | unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
48 | let src = ::core::slice::from_raw_parts(self as *const BitOffset as *const u8, Self::size());
49 | dst.copy_from_slice(src);
50 | }
51 | }
52 |
53 | impl<'a> flatbuffers::Verifiable for BitOffset {
54 | #[inline]
55 | fn run_verifier(
56 | v: &mut flatbuffers::Verifier, pos: usize
57 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
58 | use self::flatbuffers::Verifiable;
59 | v.in_buffer::(pos)
60 | }
61 | }
62 |
63 | impl<'a> BitOffset {
64 | #[allow(clippy::too_many_arguments)]
65 | pub fn new(
66 | value: i64,
67 | ) -> Self {
68 | let mut s = Self([0; 8]);
69 | s.set_value(value);
70 | s
71 | }
72 |
73 | pub fn value(&self) -> i64 {
74 | let mut mem = core::mem::MaybeUninit::<::Scalar>::uninit();
75 | // Safety:
76 | // Created from a valid Table for this object
77 | // Which contains a valid value in this slot
78 | EndianScalar::from_little_endian(unsafe {
79 | core::ptr::copy_nonoverlapping(
80 | self.0[0..].as_ptr(),
81 | mem.as_mut_ptr() as *mut u8,
82 | core::mem::size_of::<::Scalar>(),
83 | );
84 | mem.assume_init()
85 | })
86 | }
87 |
88 | pub fn set_value(&mut self, x: i64) {
89 | let x_le = x.to_little_endian();
90 | // Safety:
91 | // Created from a valid Table for this object
92 | // Which contains a valid value in this slot
93 | unsafe {
94 | core::ptr::copy_nonoverlapping(
95 | &x_le as *const _ as *const u8,
96 | self.0[0..].as_mut_ptr(),
97 | core::mem::size_of::<::Scalar>(),
98 | );
99 | }
100 | }
101 |
102 | }
103 |
104 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/type_bin/bit_shift_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | // struct BitShift, aligned to 8
13 | #[repr(transparent)]
14 | #[derive(Clone, Copy, PartialEq)]
15 | pub struct BitShift(pub [u8; 8]);
16 | impl Default for BitShift {
17 | fn default() -> Self {
18 | Self([0; 8])
19 | }
20 | }
21 | impl core::fmt::Debug for BitShift {
22 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
23 | f.debug_struct("BitShift")
24 | .field("value", &self.value())
25 | .finish()
26 | }
27 | }
28 |
29 | impl flatbuffers::SimpleToVerifyInSlice for BitShift {}
30 | impl<'a> flatbuffers::Follow<'a> for BitShift {
31 | type Inner = &'a BitShift;
32 | #[inline]
33 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
34 | <&'a BitShift>::follow(buf, loc)
35 | }
36 | }
37 | impl<'a> flatbuffers::Follow<'a> for &'a BitShift {
38 | type Inner = &'a BitShift;
39 | #[inline]
40 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
41 | flatbuffers::follow_cast_ref::(buf, loc)
42 | }
43 | }
44 | impl<'b> flatbuffers::Push for BitShift {
45 | type Output = BitShift;
46 | #[inline]
47 | unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
48 | let src = ::core::slice::from_raw_parts(self as *const BitShift as *const u8, Self::size());
49 | dst.copy_from_slice(src);
50 | }
51 | }
52 |
53 | impl<'a> flatbuffers::Verifiable for BitShift {
54 | #[inline]
55 | fn run_verifier(
56 | v: &mut flatbuffers::Verifier, pos: usize
57 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
58 | use self::flatbuffers::Verifiable;
59 | v.in_buffer::(pos)
60 | }
61 | }
62 |
63 | impl<'a> BitShift {
64 | #[allow(clippy::too_many_arguments)]
65 | pub fn new(
66 | value: i64,
67 | ) -> Self {
68 | let mut s = Self([0; 8]);
69 | s.set_value(value);
70 | s
71 | }
72 |
73 | pub fn value(&self) -> i64 {
74 | let mut mem = core::mem::MaybeUninit::<::Scalar>::uninit();
75 | // Safety:
76 | // Created from a valid Table for this object
77 | // Which contains a valid value in this slot
78 | EndianScalar::from_little_endian(unsafe {
79 | core::ptr::copy_nonoverlapping(
80 | self.0[0..].as_ptr(),
81 | mem.as_mut_ptr() as *mut u8,
82 | core::mem::size_of::<::Scalar>(),
83 | );
84 | mem.assume_init()
85 | })
86 | }
87 |
88 | pub fn set_value(&mut self, x: i64) {
89 | let x_le = x.to_little_endian();
90 | // Safety:
91 | // Created from a valid Table for this object
92 | // Which contains a valid value in this slot
93 | unsafe {
94 | core::ptr::copy_nonoverlapping(
95 | &x_le as *const _ as *const u8,
96 | self.0[0..].as_mut_ptr(),
97 | core::mem::size_of::<::Scalar>(),
98 | );
99 | }
100 | }
101 |
102 | }
103 |
104 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/type_bin/bit_size_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | // struct BitSize, aligned to 8
13 | #[repr(transparent)]
14 | #[derive(Clone, Copy, PartialEq)]
15 | pub struct BitSize(pub [u8; 8]);
16 | impl Default for BitSize {
17 | fn default() -> Self {
18 | Self([0; 8])
19 | }
20 | }
21 | impl core::fmt::Debug for BitSize {
22 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
23 | f.debug_struct("BitSize")
24 | .field("value", &self.value())
25 | .finish()
26 | }
27 | }
28 |
29 | impl flatbuffers::SimpleToVerifyInSlice for BitSize {}
30 | impl<'a> flatbuffers::Follow<'a> for BitSize {
31 | type Inner = &'a BitSize;
32 | #[inline]
33 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
34 | <&'a BitSize>::follow(buf, loc)
35 | }
36 | }
37 | impl<'a> flatbuffers::Follow<'a> for &'a BitSize {
38 | type Inner = &'a BitSize;
39 | #[inline]
40 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
41 | flatbuffers::follow_cast_ref::(buf, loc)
42 | }
43 | }
44 | impl<'b> flatbuffers::Push for BitSize {
45 | type Output = BitSize;
46 | #[inline]
47 | unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
48 | let src = ::core::slice::from_raw_parts(self as *const BitSize as *const u8, Self::size());
49 | dst.copy_from_slice(src);
50 | }
51 | }
52 |
53 | impl<'a> flatbuffers::Verifiable for BitSize {
54 | #[inline]
55 | fn run_verifier(
56 | v: &mut flatbuffers::Verifier, pos: usize
57 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
58 | use self::flatbuffers::Verifiable;
59 | v.in_buffer::(pos)
60 | }
61 | }
62 |
63 | impl<'a> BitSize {
64 | #[allow(clippy::too_many_arguments)]
65 | pub fn new(
66 | value: u64,
67 | ) -> Self {
68 | let mut s = Self([0; 8]);
69 | s.set_value(value);
70 | s
71 | }
72 |
73 | pub fn value(&self) -> u64 {
74 | let mut mem = core::mem::MaybeUninit::<::Scalar>::uninit();
75 | // Safety:
76 | // Created from a valid Table for this object
77 | // Which contains a valid value in this slot
78 | EndianScalar::from_little_endian(unsafe {
79 | core::ptr::copy_nonoverlapping(
80 | self.0[0..].as_ptr(),
81 | mem.as_mut_ptr() as *mut u8,
82 | core::mem::size_of::<::Scalar>(),
83 | );
84 | mem.assume_init()
85 | })
86 | }
87 |
88 | pub fn set_value(&mut self, x: u64) {
89 | let x_le = x.to_little_endian();
90 | // Safety:
91 | // Created from a valid Table for this object
92 | // Which contains a valid value in this slot
93 | unsafe {
94 | core::ptr::copy_nonoverlapping(
95 | &x_le as *const _ as *const u8,
96 | self.0[0..].as_mut_ptr(),
97 | core::mem::size_of::<::Scalar>(),
98 | );
99 | }
100 | }
101 |
102 | }
103 |
104 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/type_bin/bit_width_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | // struct BitWidth, aligned to 2
13 | #[repr(transparent)]
14 | #[derive(Clone, Copy, PartialEq)]
15 | pub struct BitWidth(pub [u8; 2]);
16 | impl Default for BitWidth {
17 | fn default() -> Self {
18 | Self([0; 2])
19 | }
20 | }
21 | impl core::fmt::Debug for BitWidth {
22 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
23 | f.debug_struct("BitWidth")
24 | .field("value", &self.value())
25 | .finish()
26 | }
27 | }
28 |
29 | impl flatbuffers::SimpleToVerifyInSlice for BitWidth {}
30 | impl<'a> flatbuffers::Follow<'a> for BitWidth {
31 | type Inner = &'a BitWidth;
32 | #[inline]
33 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
34 | <&'a BitWidth>::follow(buf, loc)
35 | }
36 | }
37 | impl<'a> flatbuffers::Follow<'a> for &'a BitWidth {
38 | type Inner = &'a BitWidth;
39 | #[inline]
40 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
41 | flatbuffers::follow_cast_ref::(buf, loc)
42 | }
43 | }
44 | impl<'b> flatbuffers::Push for BitWidth {
45 | type Output = BitWidth;
46 | #[inline]
47 | unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
48 | let src = ::core::slice::from_raw_parts(self as *const BitWidth as *const u8, Self::size());
49 | dst.copy_from_slice(src);
50 | }
51 | }
52 |
53 | impl<'a> flatbuffers::Verifiable for BitWidth {
54 | #[inline]
55 | fn run_verifier(
56 | v: &mut flatbuffers::Verifier, pos: usize
57 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
58 | use self::flatbuffers::Verifiable;
59 | v.in_buffer::(pos)
60 | }
61 | }
62 |
63 | impl<'a> BitWidth {
64 | #[allow(clippy::too_many_arguments)]
65 | pub fn new(
66 | value: u16,
67 | ) -> Self {
68 | let mut s = Self([0; 2]);
69 | s.set_value(value);
70 | s
71 | }
72 |
73 | pub fn value(&self) -> u16 {
74 | let mut mem = core::mem::MaybeUninit::<::Scalar>::uninit();
75 | // Safety:
76 | // Created from a valid Table for this object
77 | // Which contains a valid value in this slot
78 | EndianScalar::from_little_endian(unsafe {
79 | core::ptr::copy_nonoverlapping(
80 | self.0[0..].as_ptr(),
81 | mem.as_mut_ptr() as *mut u8,
82 | core::mem::size_of::<::Scalar>(),
83 | );
84 | mem.assume_init()
85 | })
86 | }
87 |
88 | pub fn set_value(&mut self, x: u16) {
89 | let x_le = x.to_little_endian();
90 | // Safety:
91 | // Created from a valid Table for this object
92 | // Which contains a valid value in this slot
93 | unsafe {
94 | core::ptr::copy_nonoverlapping(
95 | &x_le as *const _ as *const u8,
96 | self.0[0..].as_mut_ptr(),
97 | core::mem::size_of::<::Scalar>(),
98 | );
99 | }
100 | }
101 |
102 | }
103 |
104 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/type_bin/boolean_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | pub enum BooleanOffset {}
13 | #[derive(Copy, Clone, PartialEq)]
14 |
15 | pub struct Boolean<'a> {
16 | pub _tab: flatbuffers::Table<'a>,
17 | }
18 |
19 | impl<'a> flatbuffers::Follow<'a> for Boolean<'a> {
20 | type Inner = Boolean<'a>;
21 | #[inline]
22 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
23 | Self { _tab: flatbuffers::Table::new(buf, loc) }
24 | }
25 | }
26 |
27 | impl<'a> Boolean<'a> {
28 | pub const VT_WIDTH: flatbuffers::VOffsetT = 4;
29 |
30 | #[inline]
31 | pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
32 | Boolean { _tab: table }
33 | }
34 | #[allow(unused_mut)]
35 | pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
36 | _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
37 | args: &'args BooleanArgs<'args>
38 | ) -> flatbuffers::WIPOffset> {
39 | let mut builder = BooleanBuilder::new(_fbb);
40 | if let Some(x) = args.width { builder.add_width(x); }
41 | builder.finish()
42 | }
43 |
44 |
45 | #[inline]
46 | pub fn width(&self) -> Option<&'a BitWidth> {
47 | // Safety:
48 | // Created from valid Table for this object
49 | // which contains a valid value in this slot
50 | unsafe { self._tab.get::(Boolean::VT_WIDTH, None)}
51 | }
52 | }
53 |
54 | impl flatbuffers::Verifiable for Boolean<'_> {
55 | #[inline]
56 | fn run_verifier(
57 | v: &mut flatbuffers::Verifier, pos: usize
58 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
59 | use self::flatbuffers::Verifiable;
60 | v.visit_table(pos)?
61 | .visit_field::("width", Self::VT_WIDTH, false)?
62 | .finish();
63 | Ok(())
64 | }
65 | }
66 | pub struct BooleanArgs<'a> {
67 | pub width: Option<&'a BitWidth>,
68 | }
69 | impl<'a> Default for BooleanArgs<'a> {
70 | #[inline]
71 | fn default() -> Self {
72 | BooleanArgs {
73 | width: None,
74 | }
75 | }
76 | }
77 |
78 | pub struct BooleanBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
79 | fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
80 | start_: flatbuffers::WIPOffset,
81 | }
82 | impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> BooleanBuilder<'a, 'b, A> {
83 | #[inline]
84 | pub fn add_width(&mut self, width: &BitWidth) {
85 | self.fbb_.push_slot_always::<&BitWidth>(Boolean::VT_WIDTH, width);
86 | }
87 | #[inline]
88 | pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> BooleanBuilder<'a, 'b, A> {
89 | let start = _fbb.start_table();
90 | BooleanBuilder {
91 | fbb_: _fbb,
92 | start_: start,
93 | }
94 | }
95 | #[inline]
96 | pub fn finish(self) -> flatbuffers::WIPOffset> {
97 | let o = self.fbb_.end_table(self.start_);
98 | flatbuffers::WIPOffset::new(o.value())
99 | }
100 | }
101 |
102 | impl core::fmt::Debug for Boolean<'_> {
103 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
104 | let mut ds = f.debug_struct("Boolean");
105 | ds.field("width", &self.width());
106 | ds.finish()
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/type_bin/calling_convention_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | pub enum CallingConventionOffset {}
13 | #[derive(Copy, Clone, PartialEq)]
14 |
15 | pub struct CallingConvention<'a> {
16 | pub _tab: flatbuffers::Table<'a>,
17 | }
18 |
19 | impl<'a> flatbuffers::Follow<'a> for CallingConvention<'a> {
20 | type Inner = CallingConvention<'a>;
21 | #[inline]
22 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
23 | Self { _tab: flatbuffers::Table::new(buf, loc) }
24 | }
25 | }
26 |
27 | impl<'a> CallingConvention<'a> {
28 | pub const VT_NAME: flatbuffers::VOffsetT = 4;
29 |
30 | #[inline]
31 | pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
32 | CallingConvention { _tab: table }
33 | }
34 | #[allow(unused_mut)]
35 | pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
36 | _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
37 | args: &'args CallingConventionArgs<'args>
38 | ) -> flatbuffers::WIPOffset> {
39 | let mut builder = CallingConventionBuilder::new(_fbb);
40 | if let Some(x) = args.name { builder.add_name(x); }
41 | builder.finish()
42 | }
43 |
44 |
45 | #[inline]
46 | pub fn name(&self) -> Option<&'a str> {
47 | // Safety:
48 | // Created from valid Table for this object
49 | // which contains a valid value in this slot
50 | unsafe { self._tab.get::>(CallingConvention::VT_NAME, None)}
51 | }
52 | }
53 |
54 | impl flatbuffers::Verifiable for CallingConvention<'_> {
55 | #[inline]
56 | fn run_verifier(
57 | v: &mut flatbuffers::Verifier, pos: usize
58 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
59 | use self::flatbuffers::Verifiable;
60 | v.visit_table(pos)?
61 | .visit_field::>("name", Self::VT_NAME, false)?
62 | .finish();
63 | Ok(())
64 | }
65 | }
66 | pub struct CallingConventionArgs<'a> {
67 | pub name: Option>,
68 | }
69 | impl<'a> Default for CallingConventionArgs<'a> {
70 | #[inline]
71 | fn default() -> Self {
72 | CallingConventionArgs {
73 | name: None,
74 | }
75 | }
76 | }
77 |
78 | pub struct CallingConventionBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
79 | fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
80 | start_: flatbuffers::WIPOffset,
81 | }
82 | impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> CallingConventionBuilder<'a, 'b, A> {
83 | #[inline]
84 | pub fn add_name(&mut self, name: flatbuffers::WIPOffset<&'b str>) {
85 | self.fbb_.push_slot_always::>(CallingConvention::VT_NAME, name);
86 | }
87 | #[inline]
88 | pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> CallingConventionBuilder<'a, 'b, A> {
89 | let start = _fbb.start_table();
90 | CallingConventionBuilder {
91 | fbb_: _fbb,
92 | start_: start,
93 | }
94 | }
95 | #[inline]
96 | pub fn finish(self) -> flatbuffers::WIPOffset> {
97 | let o = self.fbb_.end_table(self.start_);
98 | flatbuffers::WIPOffset::new(o.value())
99 | }
100 | }
101 |
102 | impl core::fmt::Debug for CallingConvention<'_> {
103 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
104 | let mut ds = f.debug_struct("CallingConvention");
105 | ds.field("name", &self.name());
106 | ds.finish()
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/type_bin/character_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | pub enum CharacterOffset {}
13 | #[derive(Copy, Clone, PartialEq)]
14 |
15 | pub struct Character<'a> {
16 | pub _tab: flatbuffers::Table<'a>,
17 | }
18 |
19 | impl<'a> flatbuffers::Follow<'a> for Character<'a> {
20 | type Inner = Character<'a>;
21 | #[inline]
22 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
23 | Self { _tab: flatbuffers::Table::new(buf, loc) }
24 | }
25 | }
26 |
27 | impl<'a> Character<'a> {
28 | pub const VT_WIDTH: flatbuffers::VOffsetT = 4;
29 |
30 | #[inline]
31 | pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
32 | Character { _tab: table }
33 | }
34 | #[allow(unused_mut)]
35 | pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
36 | _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
37 | args: &'args CharacterArgs<'args>
38 | ) -> flatbuffers::WIPOffset> {
39 | let mut builder = CharacterBuilder::new(_fbb);
40 | if let Some(x) = args.width { builder.add_width(x); }
41 | builder.finish()
42 | }
43 |
44 |
45 | #[inline]
46 | pub fn width(&self) -> Option<&'a BitWidth> {
47 | // Safety:
48 | // Created from valid Table for this object
49 | // which contains a valid value in this slot
50 | unsafe { self._tab.get::(Character::VT_WIDTH, None)}
51 | }
52 | }
53 |
54 | impl flatbuffers::Verifiable for Character<'_> {
55 | #[inline]
56 | fn run_verifier(
57 | v: &mut flatbuffers::Verifier, pos: usize
58 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
59 | use self::flatbuffers::Verifiable;
60 | v.visit_table(pos)?
61 | .visit_field::("width", Self::VT_WIDTH, false)?
62 | .finish();
63 | Ok(())
64 | }
65 | }
66 | pub struct CharacterArgs<'a> {
67 | pub width: Option<&'a BitWidth>,
68 | }
69 | impl<'a> Default for CharacterArgs<'a> {
70 | #[inline]
71 | fn default() -> Self {
72 | CharacterArgs {
73 | width: None,
74 | }
75 | }
76 | }
77 |
78 | pub struct CharacterBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
79 | fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
80 | start_: flatbuffers::WIPOffset,
81 | }
82 | impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> CharacterBuilder<'a, 'b, A> {
83 | #[inline]
84 | pub fn add_width(&mut self, width: &BitWidth) {
85 | self.fbb_.push_slot_always::<&BitWidth>(Character::VT_WIDTH, width);
86 | }
87 | #[inline]
88 | pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> CharacterBuilder<'a, 'b, A> {
89 | let start = _fbb.start_table();
90 | CharacterBuilder {
91 | fbb_: _fbb,
92 | start_: start,
93 | }
94 | }
95 | #[inline]
96 | pub fn finish(self) -> flatbuffers::WIPOffset> {
97 | let o = self.fbb_.end_table(self.start_);
98 | flatbuffers::WIPOffset::new(o.value())
99 | }
100 | }
101 |
102 | impl core::fmt::Debug for Character<'_> {
103 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
104 | let mut ds = f.debug_struct("Character");
105 | ds.field("width", &self.width());
106 | ds.finish()
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/type_bin/computed_type_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | pub enum ComputedTypeOffset {}
13 | #[derive(Copy, Clone, PartialEq)]
14 |
15 | pub struct ComputedType<'a> {
16 | pub _tab: flatbuffers::Table<'a>,
17 | }
18 |
19 | impl<'a> flatbuffers::Follow<'a> for ComputedType<'a> {
20 | type Inner = ComputedType<'a>;
21 | #[inline]
22 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
23 | Self { _tab: flatbuffers::Table::new(buf, loc) }
24 | }
25 | }
26 |
27 | impl<'a> ComputedType<'a> {
28 | pub const VT_GUID: flatbuffers::VOffsetT = 4;
29 | pub const VT_TYPE_: flatbuffers::VOffsetT = 6;
30 |
31 | #[inline]
32 | pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
33 | ComputedType { _tab: table }
34 | }
35 | #[allow(unused_mut)]
36 | pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
37 | _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
38 | args: &'args ComputedTypeArgs<'args>
39 | ) -> flatbuffers::WIPOffset> {
40 | let mut builder = ComputedTypeBuilder::new(_fbb);
41 | if let Some(x) = args.type_ { builder.add_type_(x); }
42 | if let Some(x) = args.guid { builder.add_guid(x); }
43 | builder.finish()
44 | }
45 |
46 |
47 | #[inline]
48 | pub fn guid(&self) -> &'a str {
49 | // Safety:
50 | // Created from valid Table for this object
51 | // which contains a valid value in this slot
52 | unsafe { self._tab.get::>(ComputedType::VT_GUID, None).unwrap()}
53 | }
54 | #[inline]
55 | pub fn type_(&self) -> Option> {
56 | // Safety:
57 | // Created from valid Table for this object
58 | // which contains a valid value in this slot
59 | unsafe { self._tab.get::>(ComputedType::VT_TYPE_, None)}
60 | }
61 | }
62 |
63 | impl flatbuffers::Verifiable for ComputedType<'_> {
64 | #[inline]
65 | fn run_verifier(
66 | v: &mut flatbuffers::Verifier, pos: usize
67 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
68 | use self::flatbuffers::Verifiable;
69 | v.visit_table(pos)?
70 | .visit_field::>("guid", Self::VT_GUID, true)?
71 | .visit_field::>("type_", Self::VT_TYPE_, false)?
72 | .finish();
73 | Ok(())
74 | }
75 | }
76 | pub struct ComputedTypeArgs<'a> {
77 | pub guid: Option>,
78 | pub type_: Option>>,
79 | }
80 | impl<'a> Default for ComputedTypeArgs<'a> {
81 | #[inline]
82 | fn default() -> Self {
83 | ComputedTypeArgs {
84 | guid: None, // required field
85 | type_: None,
86 | }
87 | }
88 | }
89 |
90 | pub struct ComputedTypeBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
91 | fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
92 | start_: flatbuffers::WIPOffset,
93 | }
94 | impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> ComputedTypeBuilder<'a, 'b, A> {
95 | #[inline]
96 | pub fn add_guid(&mut self, guid: flatbuffers::WIPOffset<&'b str>) {
97 | self.fbb_.push_slot_always::>(ComputedType::VT_GUID, guid);
98 | }
99 | #[inline]
100 | pub fn add_type_(&mut self, type_: flatbuffers::WIPOffset>) {
101 | self.fbb_.push_slot_always::>(ComputedType::VT_TYPE_, type_);
102 | }
103 | #[inline]
104 | pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> ComputedTypeBuilder<'a, 'b, A> {
105 | let start = _fbb.start_table();
106 | ComputedTypeBuilder {
107 | fbb_: _fbb,
108 | start_: start,
109 | }
110 | }
111 | #[inline]
112 | pub fn finish(self) -> flatbuffers::WIPOffset> {
113 | let o = self.fbb_.end_table(self.start_);
114 | self.fbb_.required(o, ComputedType::VT_GUID,"guid");
115 | flatbuffers::WIPOffset::new(o.value())
116 | }
117 | }
118 |
119 | impl core::fmt::Debug for ComputedType<'_> {
120 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
121 | let mut ds = f.debug_struct("ComputedType");
122 | ds.field("guid", &self.guid());
123 | ds.field("type_", &self.type_());
124 | ds.finish()
125 | }
126 | }
127 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/type_bin/constant_modifier_class_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | pub enum ConstantModifierClassOffset {}
13 | #[derive(Copy, Clone, PartialEq)]
14 |
15 | pub struct ConstantModifierClass<'a> {
16 | pub _tab: flatbuffers::Table<'a>,
17 | }
18 |
19 | impl<'a> flatbuffers::Follow<'a> for ConstantModifierClass<'a> {
20 | type Inner = ConstantModifierClass<'a>;
21 | #[inline]
22 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
23 | Self { _tab: flatbuffers::Table::new(buf, loc) }
24 | }
25 | }
26 |
27 | impl<'a> ConstantModifierClass<'a> {
28 |
29 | #[inline]
30 | pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
31 | ConstantModifierClass { _tab: table }
32 | }
33 | #[allow(unused_mut)]
34 | pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
35 | _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
36 | _args: &'args ConstantModifierClassArgs
37 | ) -> flatbuffers::WIPOffset> {
38 | let mut builder = ConstantModifierClassBuilder::new(_fbb);
39 | builder.finish()
40 | }
41 |
42 | }
43 |
44 | impl flatbuffers::Verifiable for ConstantModifierClass<'_> {
45 | #[inline]
46 | fn run_verifier(
47 | v: &mut flatbuffers::Verifier, pos: usize
48 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
49 | use self::flatbuffers::Verifiable;
50 | v.visit_table(pos)?
51 | .finish();
52 | Ok(())
53 | }
54 | }
55 | pub struct ConstantModifierClassArgs {
56 | }
57 | impl<'a> Default for ConstantModifierClassArgs {
58 | #[inline]
59 | fn default() -> Self {
60 | ConstantModifierClassArgs {
61 | }
62 | }
63 | }
64 |
65 | pub struct ConstantModifierClassBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
66 | fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
67 | start_: flatbuffers::WIPOffset,
68 | }
69 | impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> ConstantModifierClassBuilder<'a, 'b, A> {
70 | #[inline]
71 | pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> ConstantModifierClassBuilder<'a, 'b, A> {
72 | let start = _fbb.start_table();
73 | ConstantModifierClassBuilder {
74 | fbb_: _fbb,
75 | start_: start,
76 | }
77 | }
78 | #[inline]
79 | pub fn finish(self) -> flatbuffers::WIPOffset> {
80 | let o = self.fbb_.end_table(self.start_);
81 | flatbuffers::WIPOffset::new(o.value())
82 | }
83 | }
84 |
85 | impl core::fmt::Debug for ConstantModifierClass<'_> {
86 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
87 | let mut ds = f.debug_struct("ConstantModifierClass");
88 | ds.finish()
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/type_bin/descriptor_modifier_class_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | pub enum DescriptorModifierClassOffset {}
13 | #[derive(Copy, Clone, PartialEq)]
14 |
15 | pub struct DescriptorModifierClass<'a> {
16 | pub _tab: flatbuffers::Table<'a>,
17 | }
18 |
19 | impl<'a> flatbuffers::Follow<'a> for DescriptorModifierClass<'a> {
20 | type Inner = DescriptorModifierClass<'a>;
21 | #[inline]
22 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
23 | Self { _tab: flatbuffers::Table::new(buf, loc) }
24 | }
25 | }
26 |
27 | impl<'a> DescriptorModifierClass<'a> {
28 | pub const VT_DESCRIPTION: flatbuffers::VOffsetT = 4;
29 |
30 | #[inline]
31 | pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
32 | DescriptorModifierClass { _tab: table }
33 | }
34 | #[allow(unused_mut)]
35 | pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
36 | _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
37 | args: &'args DescriptorModifierClassArgs<'args>
38 | ) -> flatbuffers::WIPOffset> {
39 | let mut builder = DescriptorModifierClassBuilder::new(_fbb);
40 | if let Some(x) = args.description { builder.add_description(x); }
41 | builder.finish()
42 | }
43 |
44 |
45 | #[inline]
46 | pub fn description(&self) -> Option<&'a str> {
47 | // Safety:
48 | // Created from valid Table for this object
49 | // which contains a valid value in this slot
50 | unsafe { self._tab.get::>(DescriptorModifierClass::VT_DESCRIPTION, None)}
51 | }
52 | }
53 |
54 | impl flatbuffers::Verifiable for DescriptorModifierClass<'_> {
55 | #[inline]
56 | fn run_verifier(
57 | v: &mut flatbuffers::Verifier, pos: usize
58 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
59 | use self::flatbuffers::Verifiable;
60 | v.visit_table(pos)?
61 | .visit_field::>("description", Self::VT_DESCRIPTION, false)?
62 | .finish();
63 | Ok(())
64 | }
65 | }
66 | pub struct DescriptorModifierClassArgs<'a> {
67 | pub description: Option>,
68 | }
69 | impl<'a> Default for DescriptorModifierClassArgs<'a> {
70 | #[inline]
71 | fn default() -> Self {
72 | DescriptorModifierClassArgs {
73 | description: None,
74 | }
75 | }
76 | }
77 |
78 | pub struct DescriptorModifierClassBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
79 | fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
80 | start_: flatbuffers::WIPOffset,
81 | }
82 | impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DescriptorModifierClassBuilder<'a, 'b, A> {
83 | #[inline]
84 | pub fn add_description(&mut self, description: flatbuffers::WIPOffset<&'b str>) {
85 | self.fbb_.push_slot_always::>(DescriptorModifierClass::VT_DESCRIPTION, description);
86 | }
87 | #[inline]
88 | pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DescriptorModifierClassBuilder<'a, 'b, A> {
89 | let start = _fbb.start_table();
90 | DescriptorModifierClassBuilder {
91 | fbb_: _fbb,
92 | start_: start,
93 | }
94 | }
95 | #[inline]
96 | pub fn finish(self) -> flatbuffers::WIPOffset> {
97 | let o = self.fbb_.end_table(self.start_);
98 | flatbuffers::WIPOffset::new(o.value())
99 | }
100 | }
101 |
102 | impl core::fmt::Debug for DescriptorModifierClass<'_> {
103 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
104 | let mut ds = f.debug_struct("DescriptorModifierClass");
105 | ds.field("description", &self.description());
106 | ds.finish()
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/type_bin/enumeration_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | pub enum EnumerationOffset {}
13 | #[derive(Copy, Clone, PartialEq)]
14 |
15 | pub struct Enumeration<'a> {
16 | pub _tab: flatbuffers::Table<'a>,
17 | }
18 |
19 | impl<'a> flatbuffers::Follow<'a> for Enumeration<'a> {
20 | type Inner = Enumeration<'a>;
21 | #[inline]
22 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
23 | Self { _tab: flatbuffers::Table::new(buf, loc) }
24 | }
25 | }
26 |
27 | impl<'a> Enumeration<'a> {
28 | pub const VT_MEMBER_TYPE: flatbuffers::VOffsetT = 4;
29 | pub const VT_MEMBERS: flatbuffers::VOffsetT = 6;
30 |
31 | #[inline]
32 | pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
33 | Enumeration { _tab: table }
34 | }
35 | #[allow(unused_mut)]
36 | pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
37 | _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
38 | args: &'args EnumerationArgs<'args>
39 | ) -> flatbuffers::WIPOffset> {
40 | let mut builder = EnumerationBuilder::new(_fbb);
41 | if let Some(x) = args.members { builder.add_members(x); }
42 | if let Some(x) = args.member_type { builder.add_member_type(x); }
43 | builder.finish()
44 | }
45 |
46 |
47 | #[inline]
48 | pub fn member_type(&self) -> Type<'a> {
49 | // Safety:
50 | // Created from valid Table for this object
51 | // which contains a valid value in this slot
52 | unsafe { self._tab.get::>(Enumeration::VT_MEMBER_TYPE, None).unwrap()}
53 | }
54 | #[inline]
55 | pub fn members(&self) -> Option>>> {
56 | // Safety:
57 | // Created from valid Table for this object
58 | // which contains a valid value in this slot
59 | unsafe { self._tab.get::>>>(Enumeration::VT_MEMBERS, None)}
60 | }
61 | }
62 |
63 | impl flatbuffers::Verifiable for Enumeration<'_> {
64 | #[inline]
65 | fn run_verifier(
66 | v: &mut flatbuffers::Verifier, pos: usize
67 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
68 | use self::flatbuffers::Verifiable;
69 | v.visit_table(pos)?
70 | .visit_field::>("member_type", Self::VT_MEMBER_TYPE, true)?
71 | .visit_field::>>>("members", Self::VT_MEMBERS, false)?
72 | .finish();
73 | Ok(())
74 | }
75 | }
76 | pub struct EnumerationArgs<'a> {
77 | pub member_type: Option>>,
78 | pub members: Option>>>>,
79 | }
80 | impl<'a> Default for EnumerationArgs<'a> {
81 | #[inline]
82 | fn default() -> Self {
83 | EnumerationArgs {
84 | member_type: None, // required field
85 | members: None,
86 | }
87 | }
88 | }
89 |
90 | pub struct EnumerationBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
91 | fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
92 | start_: flatbuffers::WIPOffset,
93 | }
94 | impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> EnumerationBuilder<'a, 'b, A> {
95 | #[inline]
96 | pub fn add_member_type(&mut self, member_type: flatbuffers::WIPOffset>) {
97 | self.fbb_.push_slot_always::>(Enumeration::VT_MEMBER_TYPE, member_type);
98 | }
99 | #[inline]
100 | pub fn add_members(&mut self, members: flatbuffers::WIPOffset>>>) {
101 | self.fbb_.push_slot_always::>(Enumeration::VT_MEMBERS, members);
102 | }
103 | #[inline]
104 | pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> EnumerationBuilder<'a, 'b, A> {
105 | let start = _fbb.start_table();
106 | EnumerationBuilder {
107 | fbb_: _fbb,
108 | start_: start,
109 | }
110 | }
111 | #[inline]
112 | pub fn finish(self) -> flatbuffers::WIPOffset> {
113 | let o = self.fbb_.end_table(self.start_);
114 | self.fbb_.required(o, Enumeration::VT_MEMBER_TYPE,"member_type");
115 | flatbuffers::WIPOffset::new(o.value())
116 | }
117 | }
118 |
119 | impl core::fmt::Debug for Enumeration<'_> {
120 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
121 | let mut ds = f.debug_struct("Enumeration");
122 | ds.field("member_type", &self.member_type());
123 | ds.field("members", &self.members());
124 | ds.finish()
125 | }
126 | }
127 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/type_bin/enumeration_member_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | pub enum EnumerationMemberOffset {}
13 | #[derive(Copy, Clone, PartialEq)]
14 |
15 | pub struct EnumerationMember<'a> {
16 | pub _tab: flatbuffers::Table<'a>,
17 | }
18 |
19 | impl<'a> flatbuffers::Follow<'a> for EnumerationMember<'a> {
20 | type Inner = EnumerationMember<'a>;
21 | #[inline]
22 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
23 | Self { _tab: flatbuffers::Table::new(buf, loc) }
24 | }
25 | }
26 |
27 | impl<'a> EnumerationMember<'a> {
28 | pub const VT_NAME: flatbuffers::VOffsetT = 4;
29 | pub const VT_CONSTANT: flatbuffers::VOffsetT = 6;
30 |
31 | #[inline]
32 | pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
33 | EnumerationMember { _tab: table }
34 | }
35 | #[allow(unused_mut)]
36 | pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
37 | _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
38 | args: &'args EnumerationMemberArgs<'args>
39 | ) -> flatbuffers::WIPOffset> {
40 | let mut builder = EnumerationMemberBuilder::new(_fbb);
41 | builder.add_constant(args.constant);
42 | if let Some(x) = args.name { builder.add_name(x); }
43 | builder.finish()
44 | }
45 |
46 |
47 | #[inline]
48 | pub fn name(&self) -> Option<&'a str> {
49 | // Safety:
50 | // Created from valid Table for this object
51 | // which contains a valid value in this slot
52 | unsafe { self._tab.get::>(EnumerationMember::VT_NAME, None)}
53 | }
54 | #[inline]
55 | pub fn constant(&self) -> u64 {
56 | // Safety:
57 | // Created from valid Table for this object
58 | // which contains a valid value in this slot
59 | unsafe { self._tab.get::(EnumerationMember::VT_CONSTANT, Some(0)).unwrap()}
60 | }
61 | }
62 |
63 | impl flatbuffers::Verifiable for EnumerationMember<'_> {
64 | #[inline]
65 | fn run_verifier(
66 | v: &mut flatbuffers::Verifier, pos: usize
67 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
68 | use self::flatbuffers::Verifiable;
69 | v.visit_table(pos)?
70 | .visit_field::>("name", Self::VT_NAME, false)?
71 | .visit_field::("constant", Self::VT_CONSTANT, false)?
72 | .finish();
73 | Ok(())
74 | }
75 | }
76 | pub struct EnumerationMemberArgs<'a> {
77 | pub name: Option>,
78 | pub constant: u64,
79 | }
80 | impl<'a> Default for EnumerationMemberArgs<'a> {
81 | #[inline]
82 | fn default() -> Self {
83 | EnumerationMemberArgs {
84 | name: None,
85 | constant: 0,
86 | }
87 | }
88 | }
89 |
90 | pub struct EnumerationMemberBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
91 | fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
92 | start_: flatbuffers::WIPOffset,
93 | }
94 | impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> EnumerationMemberBuilder<'a, 'b, A> {
95 | #[inline]
96 | pub fn add_name(&mut self, name: flatbuffers::WIPOffset<&'b str>) {
97 | self.fbb_.push_slot_always::>(EnumerationMember::VT_NAME, name);
98 | }
99 | #[inline]
100 | pub fn add_constant(&mut self, constant: u64) {
101 | self.fbb_.push_slot::(EnumerationMember::VT_CONSTANT, constant, 0);
102 | }
103 | #[inline]
104 | pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> EnumerationMemberBuilder<'a, 'b, A> {
105 | let start = _fbb.start_table();
106 | EnumerationMemberBuilder {
107 | fbb_: _fbb,
108 | start_: start,
109 | }
110 | }
111 | #[inline]
112 | pub fn finish(self) -> flatbuffers::WIPOffset> {
113 | let o = self.fbb_.end_table(self.start_);
114 | flatbuffers::WIPOffset::new(o.value())
115 | }
116 | }
117 |
118 | impl core::fmt::Debug for EnumerationMember<'_> {
119 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
120 | let mut ds = f.debug_struct("EnumerationMember");
121 | ds.field("name", &self.name());
122 | ds.field("constant", &self.constant());
123 | ds.finish()
124 | }
125 | }
126 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/type_bin/fixed_alignment_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | pub enum FixedAlignmentOffset {}
13 | #[derive(Copy, Clone, PartialEq)]
14 |
15 | pub struct FixedAlignment<'a> {
16 | pub _tab: flatbuffers::Table<'a>,
17 | }
18 |
19 | impl<'a> flatbuffers::Follow<'a> for FixedAlignment<'a> {
20 | type Inner = FixedAlignment<'a>;
21 | #[inline]
22 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
23 | Self { _tab: flatbuffers::Table::new(buf, loc) }
24 | }
25 | }
26 |
27 | impl<'a> FixedAlignment<'a> {
28 | pub const VT_WIDTH: flatbuffers::VOffsetT = 4;
29 |
30 | #[inline]
31 | pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
32 | FixedAlignment { _tab: table }
33 | }
34 | #[allow(unused_mut)]
35 | pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
36 | _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
37 | args: &'args FixedAlignmentArgs<'args>
38 | ) -> flatbuffers::WIPOffset> {
39 | let mut builder = FixedAlignmentBuilder::new(_fbb);
40 | if let Some(x) = args.width { builder.add_width(x); }
41 | builder.finish()
42 | }
43 |
44 |
45 | #[inline]
46 | pub fn width(&self) -> Option<&'a BitWidth> {
47 | // Safety:
48 | // Created from valid Table for this object
49 | // which contains a valid value in this slot
50 | unsafe { self._tab.get::(FixedAlignment::VT_WIDTH, None)}
51 | }
52 | }
53 |
54 | impl flatbuffers::Verifiable for FixedAlignment<'_> {
55 | #[inline]
56 | fn run_verifier(
57 | v: &mut flatbuffers::Verifier, pos: usize
58 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
59 | use self::flatbuffers::Verifiable;
60 | v.visit_table(pos)?
61 | .visit_field::("width", Self::VT_WIDTH, false)?
62 | .finish();
63 | Ok(())
64 | }
65 | }
66 | pub struct FixedAlignmentArgs<'a> {
67 | pub width: Option<&'a BitWidth>,
68 | }
69 | impl<'a> Default for FixedAlignmentArgs<'a> {
70 | #[inline]
71 | fn default() -> Self {
72 | FixedAlignmentArgs {
73 | width: None,
74 | }
75 | }
76 | }
77 |
78 | pub struct FixedAlignmentBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
79 | fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
80 | start_: flatbuffers::WIPOffset,
81 | }
82 | impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> FixedAlignmentBuilder<'a, 'b, A> {
83 | #[inline]
84 | pub fn add_width(&mut self, width: &BitWidth) {
85 | self.fbb_.push_slot_always::<&BitWidth>(FixedAlignment::VT_WIDTH, width);
86 | }
87 | #[inline]
88 | pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> FixedAlignmentBuilder<'a, 'b, A> {
89 | let start = _fbb.start_table();
90 | FixedAlignmentBuilder {
91 | fbb_: _fbb,
92 | start_: start,
93 | }
94 | }
95 | #[inline]
96 | pub fn finish(self) -> flatbuffers::WIPOffset> {
97 | let o = self.fbb_.end_table(self.start_);
98 | flatbuffers::WIPOffset::new(o.value())
99 | }
100 | }
101 |
102 | impl core::fmt::Debug for FixedAlignment<'_> {
103 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
104 | let mut ds = f.debug_struct("FixedAlignment");
105 | ds.field("width", &self.width());
106 | ds.finish()
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/type_bin/float_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | pub enum FloatOffset {}
13 | #[derive(Copy, Clone, PartialEq)]
14 |
15 | pub struct Float<'a> {
16 | pub _tab: flatbuffers::Table<'a>,
17 | }
18 |
19 | impl<'a> flatbuffers::Follow<'a> for Float<'a> {
20 | type Inner = Float<'a>;
21 | #[inline]
22 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
23 | Self { _tab: flatbuffers::Table::new(buf, loc) }
24 | }
25 | }
26 |
27 | impl<'a> Float<'a> {
28 | pub const VT_WIDTH: flatbuffers::VOffsetT = 4;
29 |
30 | #[inline]
31 | pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
32 | Float { _tab: table }
33 | }
34 | #[allow(unused_mut)]
35 | pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
36 | _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
37 | args: &'args FloatArgs<'args>
38 | ) -> flatbuffers::WIPOffset> {
39 | let mut builder = FloatBuilder::new(_fbb);
40 | if let Some(x) = args.width { builder.add_width(x); }
41 | builder.finish()
42 | }
43 |
44 |
45 | #[inline]
46 | pub fn width(&self) -> Option<&'a BitWidth> {
47 | // Safety:
48 | // Created from valid Table for this object
49 | // which contains a valid value in this slot
50 | unsafe { self._tab.get::(Float::VT_WIDTH, None)}
51 | }
52 | }
53 |
54 | impl flatbuffers::Verifiable for Float<'_> {
55 | #[inline]
56 | fn run_verifier(
57 | v: &mut flatbuffers::Verifier, pos: usize
58 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
59 | use self::flatbuffers::Verifiable;
60 | v.visit_table(pos)?
61 | .visit_field::("width", Self::VT_WIDTH, false)?
62 | .finish();
63 | Ok(())
64 | }
65 | }
66 | pub struct FloatArgs<'a> {
67 | pub width: Option<&'a BitWidth>,
68 | }
69 | impl<'a> Default for FloatArgs<'a> {
70 | #[inline]
71 | fn default() -> Self {
72 | FloatArgs {
73 | width: None,
74 | }
75 | }
76 | }
77 |
78 | pub struct FloatBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
79 | fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
80 | start_: flatbuffers::WIPOffset,
81 | }
82 | impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> FloatBuilder<'a, 'b, A> {
83 | #[inline]
84 | pub fn add_width(&mut self, width: &BitWidth) {
85 | self.fbb_.push_slot_always::<&BitWidth>(Float::VT_WIDTH, width);
86 | }
87 | #[inline]
88 | pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> FloatBuilder<'a, 'b, A> {
89 | let start = _fbb.start_table();
90 | FloatBuilder {
91 | fbb_: _fbb,
92 | start_: start,
93 | }
94 | }
95 | #[inline]
96 | pub fn finish(self) -> flatbuffers::WIPOffset> {
97 | let o = self.fbb_.end_table(self.start_);
98 | flatbuffers::WIPOffset::new(o.value())
99 | }
100 | }
101 |
102 | impl core::fmt::Debug for Float<'_> {
103 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
104 | let mut ds = f.debug_struct("Float");
105 | ds.field("width", &self.width());
106 | ds.finish()
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/type_bin/integer_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | pub enum IntegerOffset {}
13 | #[derive(Copy, Clone, PartialEq)]
14 |
15 | pub struct Integer<'a> {
16 | pub _tab: flatbuffers::Table<'a>,
17 | }
18 |
19 | impl<'a> flatbuffers::Follow<'a> for Integer<'a> {
20 | type Inner = Integer<'a>;
21 | #[inline]
22 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
23 | Self { _tab: flatbuffers::Table::new(buf, loc) }
24 | }
25 | }
26 |
27 | impl<'a> Integer<'a> {
28 | pub const VT_WIDTH: flatbuffers::VOffsetT = 4;
29 | pub const VT_SIGNED: flatbuffers::VOffsetT = 6;
30 |
31 | #[inline]
32 | pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
33 | Integer { _tab: table }
34 | }
35 | #[allow(unused_mut)]
36 | pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
37 | _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
38 | args: &'args IntegerArgs<'args>
39 | ) -> flatbuffers::WIPOffset> {
40 | let mut builder = IntegerBuilder::new(_fbb);
41 | if let Some(x) = args.width { builder.add_width(x); }
42 | builder.add_signed(args.signed);
43 | builder.finish()
44 | }
45 |
46 |
47 | #[inline]
48 | pub fn width(&self) -> Option<&'a BitWidth> {
49 | // Safety:
50 | // Created from valid Table for this object
51 | // which contains a valid value in this slot
52 | unsafe { self._tab.get::(Integer::VT_WIDTH, None)}
53 | }
54 | #[inline]
55 | pub fn signed(&self) -> bool {
56 | // Safety:
57 | // Created from valid Table for this object
58 | // which contains a valid value in this slot
59 | unsafe { self._tab.get::(Integer::VT_SIGNED, Some(false)).unwrap()}
60 | }
61 | }
62 |
63 | impl flatbuffers::Verifiable for Integer<'_> {
64 | #[inline]
65 | fn run_verifier(
66 | v: &mut flatbuffers::Verifier, pos: usize
67 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
68 | use self::flatbuffers::Verifiable;
69 | v.visit_table(pos)?
70 | .visit_field::("width", Self::VT_WIDTH, false)?
71 | .visit_field::("signed", Self::VT_SIGNED, false)?
72 | .finish();
73 | Ok(())
74 | }
75 | }
76 | pub struct IntegerArgs<'a> {
77 | pub width: Option<&'a BitWidth>,
78 | pub signed: bool,
79 | }
80 | impl<'a> Default for IntegerArgs<'a> {
81 | #[inline]
82 | fn default() -> Self {
83 | IntegerArgs {
84 | width: None,
85 | signed: false,
86 | }
87 | }
88 | }
89 |
90 | pub struct IntegerBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
91 | fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
92 | start_: flatbuffers::WIPOffset,
93 | }
94 | impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> IntegerBuilder<'a, 'b, A> {
95 | #[inline]
96 | pub fn add_width(&mut self, width: &BitWidth) {
97 | self.fbb_.push_slot_always::<&BitWidth>(Integer::VT_WIDTH, width);
98 | }
99 | #[inline]
100 | pub fn add_signed(&mut self, signed: bool) {
101 | self.fbb_.push_slot::(Integer::VT_SIGNED, signed, false);
102 | }
103 | #[inline]
104 | pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> IntegerBuilder<'a, 'b, A> {
105 | let start = _fbb.start_table();
106 | IntegerBuilder {
107 | fbb_: _fbb,
108 | start_: start,
109 | }
110 | }
111 | #[inline]
112 | pub fn finish(self) -> flatbuffers::WIPOffset> {
113 | let o = self.fbb_.end_table(self.start_);
114 | flatbuffers::WIPOffset::new(o.value())
115 | }
116 | }
117 |
118 | impl core::fmt::Debug for Integer<'_> {
119 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
120 | let mut ds = f.debug_struct("Integer");
121 | ds.field("width", &self.width());
122 | ds.field("signed", &self.signed());
123 | ds.finish()
124 | }
125 | }
126 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/type_bin/location_class_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
13 | pub const ENUM_MIN_LOCATION_CLASS: u8 = 0;
14 | #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
15 | pub const ENUM_MAX_LOCATION_CLASS: u8 = 2;
16 | #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
17 | #[allow(non_camel_case_types)]
18 | pub const ENUM_VALUES_LOCATION_CLASS: [LocationClass; 3] = [
19 | LocationClass::NONE,
20 | LocationClass::RegisterLocation,
21 | LocationClass::StackLocation,
22 | ];
23 |
24 | #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
25 | #[repr(transparent)]
26 | pub struct LocationClass(pub u8);
27 | #[allow(non_upper_case_globals)]
28 | impl LocationClass {
29 | pub const NONE: Self = Self(0);
30 | pub const RegisterLocation: Self = Self(1);
31 | pub const StackLocation: Self = Self(2);
32 |
33 | pub const ENUM_MIN: u8 = 0;
34 | pub const ENUM_MAX: u8 = 2;
35 | pub const ENUM_VALUES: &'static [Self] = &[
36 | Self::NONE,
37 | Self::RegisterLocation,
38 | Self::StackLocation,
39 | ];
40 | /// Returns the variant's name or "" if unknown.
41 | pub fn variant_name(self) -> Option<&'static str> {
42 | match self {
43 | Self::NONE => Some("NONE"),
44 | Self::RegisterLocation => Some("RegisterLocation"),
45 | Self::StackLocation => Some("StackLocation"),
46 | _ => None,
47 | }
48 | }
49 | }
50 | impl core::fmt::Debug for LocationClass {
51 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
52 | if let Some(name) = self.variant_name() {
53 | f.write_str(name)
54 | } else {
55 | f.write_fmt(format_args!("", self.0))
56 | }
57 | }
58 | }
59 | impl<'a> flatbuffers::Follow<'a> for LocationClass {
60 | type Inner = Self;
61 | #[inline]
62 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
63 | let b = flatbuffers::read_scalar_at::(buf, loc);
64 | Self(b)
65 | }
66 | }
67 |
68 | impl flatbuffers::Push for LocationClass {
69 | type Output = LocationClass;
70 | #[inline]
71 | unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
72 | flatbuffers::emplace_scalar::(dst, self.0);
73 | }
74 | }
75 |
76 | impl flatbuffers::EndianScalar for LocationClass {
77 | type Scalar = u8;
78 | #[inline]
79 | fn to_little_endian(self) -> u8 {
80 | self.0.to_le()
81 | }
82 | #[inline]
83 | #[allow(clippy::wrong_self_convention)]
84 | fn from_little_endian(v: u8) -> Self {
85 | let b = u8::from_le(v);
86 | Self(b)
87 | }
88 | }
89 |
90 | impl<'a> flatbuffers::Verifiable for LocationClass {
91 | #[inline]
92 | fn run_verifier(
93 | v: &mut flatbuffers::Verifier, pos: usize
94 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
95 | use self::flatbuffers::Verifiable;
96 | u8::run_verifier(v, pos)
97 | }
98 | }
99 |
100 | impl flatbuffers::SimpleToVerifyInSlice for LocationClass {}
101 | pub struct LocationClassUnionTableOffset {}
102 |
103 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/type_bin/metadata_modifier_class_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | pub enum MetadataModifierClassOffset {}
13 | #[derive(Copy, Clone, PartialEq)]
14 |
15 | pub struct MetadataModifierClass<'a> {
16 | pub _tab: flatbuffers::Table<'a>,
17 | }
18 |
19 | impl<'a> flatbuffers::Follow<'a> for MetadataModifierClass<'a> {
20 | type Inner = MetadataModifierClass<'a>;
21 | #[inline]
22 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
23 | Self { _tab: flatbuffers::Table::new(buf, loc) }
24 | }
25 | }
26 |
27 | impl<'a> MetadataModifierClass<'a> {
28 | pub const VT_KEY: flatbuffers::VOffsetT = 4;
29 | pub const VT_VALUE: flatbuffers::VOffsetT = 6;
30 |
31 | #[inline]
32 | pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
33 | MetadataModifierClass { _tab: table }
34 | }
35 | #[allow(unused_mut)]
36 | pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
37 | _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
38 | args: &'args MetadataModifierClassArgs<'args>
39 | ) -> flatbuffers::WIPOffset> {
40 | let mut builder = MetadataModifierClassBuilder::new(_fbb);
41 | if let Some(x) = args.value { builder.add_value(x); }
42 | if let Some(x) = args.key { builder.add_key(x); }
43 | builder.finish()
44 | }
45 |
46 |
47 | #[inline]
48 | pub fn key(&self) -> Option<&'a str> {
49 | // Safety:
50 | // Created from valid Table for this object
51 | // which contains a valid value in this slot
52 | unsafe { self._tab.get::>(MetadataModifierClass::VT_KEY, None)}
53 | }
54 | #[inline]
55 | pub fn value(&self) -> Option> {
56 | // Safety:
57 | // Created from valid Table for this object
58 | // which contains a valid value in this slot
59 | unsafe { self._tab.get::>>(MetadataModifierClass::VT_VALUE, None)}
60 | }
61 | }
62 |
63 | impl flatbuffers::Verifiable for MetadataModifierClass<'_> {
64 | #[inline]
65 | fn run_verifier(
66 | v: &mut flatbuffers::Verifier, pos: usize
67 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
68 | use self::flatbuffers::Verifiable;
69 | v.visit_table(pos)?
70 | .visit_field::>("key", Self::VT_KEY, false)?
71 | .visit_field::>>("value", Self::VT_VALUE, false)?
72 | .finish();
73 | Ok(())
74 | }
75 | }
76 | pub struct MetadataModifierClassArgs<'a> {
77 | pub key: Option>,
78 | pub value: Option>>,
79 | }
80 | impl<'a> Default for MetadataModifierClassArgs<'a> {
81 | #[inline]
82 | fn default() -> Self {
83 | MetadataModifierClassArgs {
84 | key: None,
85 | value: None,
86 | }
87 | }
88 | }
89 |
90 | pub struct MetadataModifierClassBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
91 | fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
92 | start_: flatbuffers::WIPOffset,
93 | }
94 | impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> MetadataModifierClassBuilder<'a, 'b, A> {
95 | #[inline]
96 | pub fn add_key(&mut self, key: flatbuffers::WIPOffset<&'b str>) {
97 | self.fbb_.push_slot_always::>(MetadataModifierClass::VT_KEY, key);
98 | }
99 | #[inline]
100 | pub fn add_value(&mut self, value: flatbuffers::WIPOffset>) {
101 | self.fbb_.push_slot_always::>(MetadataModifierClass::VT_VALUE, value);
102 | }
103 | #[inline]
104 | pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> MetadataModifierClassBuilder<'a, 'b, A> {
105 | let start = _fbb.start_table();
106 | MetadataModifierClassBuilder {
107 | fbb_: _fbb,
108 | start_: start,
109 | }
110 | }
111 | #[inline]
112 | pub fn finish(self) -> flatbuffers::WIPOffset> {
113 | let o = self.fbb_.end_table(self.start_);
114 | flatbuffers::WIPOffset::new(o.value())
115 | }
116 | }
117 |
118 | impl core::fmt::Debug for MetadataModifierClass<'_> {
119 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
120 | let mut ds = f.debug_struct("MetadataModifierClass");
121 | ds.field("key", &self.key());
122 | ds.field("value", &self.value());
123 | ds.finish()
124 | }
125 | }
126 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/type_bin/pointer_addressing_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
13 | pub const ENUM_MIN_POINTER_ADDRESSING: i8 = 0;
14 | #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
15 | pub const ENUM_MAX_POINTER_ADDRESSING: i8 = 2;
16 | #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
17 | #[allow(non_camel_case_types)]
18 | pub const ENUM_VALUES_POINTER_ADDRESSING: [PointerAddressing; 3] = [
19 | PointerAddressing::Absolute,
20 | PointerAddressing::RelativeBase,
21 | PointerAddressing::RelativeSelf,
22 | ];
23 |
24 | #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
25 | #[repr(transparent)]
26 | pub struct PointerAddressing(pub i8);
27 | #[allow(non_upper_case_globals)]
28 | impl PointerAddressing {
29 | pub const Absolute: Self = Self(0);
30 | pub const RelativeBase: Self = Self(1);
31 | pub const RelativeSelf: Self = Self(2);
32 |
33 | pub const ENUM_MIN: i8 = 0;
34 | pub const ENUM_MAX: i8 = 2;
35 | pub const ENUM_VALUES: &'static [Self] = &[
36 | Self::Absolute,
37 | Self::RelativeBase,
38 | Self::RelativeSelf,
39 | ];
40 | /// Returns the variant's name or "" if unknown.
41 | pub fn variant_name(self) -> Option<&'static str> {
42 | match self {
43 | Self::Absolute => Some("Absolute"),
44 | Self::RelativeBase => Some("RelativeBase"),
45 | Self::RelativeSelf => Some("RelativeSelf"),
46 | _ => None,
47 | }
48 | }
49 | }
50 | impl core::fmt::Debug for PointerAddressing {
51 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
52 | if let Some(name) = self.variant_name() {
53 | f.write_str(name)
54 | } else {
55 | f.write_fmt(format_args!("", self.0))
56 | }
57 | }
58 | }
59 | impl<'a> flatbuffers::Follow<'a> for PointerAddressing {
60 | type Inner = Self;
61 | #[inline]
62 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
63 | let b = flatbuffers::read_scalar_at::(buf, loc);
64 | Self(b)
65 | }
66 | }
67 |
68 | impl flatbuffers::Push for PointerAddressing {
69 | type Output = PointerAddressing;
70 | #[inline]
71 | unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
72 | flatbuffers::emplace_scalar::(dst, self.0);
73 | }
74 | }
75 |
76 | impl flatbuffers::EndianScalar for PointerAddressing {
77 | type Scalar = i8;
78 | #[inline]
79 | fn to_little_endian(self) -> i8 {
80 | self.0.to_le()
81 | }
82 | #[inline]
83 | #[allow(clippy::wrong_self_convention)]
84 | fn from_little_endian(v: i8) -> Self {
85 | let b = i8::from_le(v);
86 | Self(b)
87 | }
88 | }
89 |
90 | impl<'a> flatbuffers::Verifiable for PointerAddressing {
91 | #[inline]
92 | fn run_verifier(
93 | v: &mut flatbuffers::Verifier, pos: usize
94 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
95 | use self::flatbuffers::Verifiable;
96 | i8::run_verifier(v, pos)
97 | }
98 | }
99 |
100 | impl flatbuffers::SimpleToVerifyInSlice for PointerAddressing {}
101 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/type_bin/referrer_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | pub enum ReferrerOffset {}
13 | #[derive(Copy, Clone, PartialEq)]
14 |
15 | pub struct Referrer<'a> {
16 | pub _tab: flatbuffers::Table<'a>,
17 | }
18 |
19 | impl<'a> flatbuffers::Follow<'a> for Referrer<'a> {
20 | type Inner = Referrer<'a>;
21 | #[inline]
22 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
23 | Self { _tab: flatbuffers::Table::new(buf, loc) }
24 | }
25 | }
26 |
27 | impl<'a> Referrer<'a> {
28 | pub const VT_GUID: flatbuffers::VOffsetT = 4;
29 | pub const VT_NAME: flatbuffers::VOffsetT = 6;
30 |
31 | #[inline]
32 | pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
33 | Referrer { _tab: table }
34 | }
35 | #[allow(unused_mut)]
36 | pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
37 | _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
38 | args: &'args ReferrerArgs<'args>
39 | ) -> flatbuffers::WIPOffset> {
40 | let mut builder = ReferrerBuilder::new(_fbb);
41 | if let Some(x) = args.name { builder.add_name(x); }
42 | if let Some(x) = args.guid { builder.add_guid(x); }
43 | builder.finish()
44 | }
45 |
46 |
47 | #[inline]
48 | pub fn guid(&self) -> Option<&'a str> {
49 | // Safety:
50 | // Created from valid Table for this object
51 | // which contains a valid value in this slot
52 | unsafe { self._tab.get::>(Referrer::VT_GUID, None)}
53 | }
54 | #[inline]
55 | pub fn name(&self) -> Option<&'a str> {
56 | // Safety:
57 | // Created from valid Table for this object
58 | // which contains a valid value in this slot
59 | unsafe { self._tab.get::>(Referrer::VT_NAME, None)}
60 | }
61 | }
62 |
63 | impl flatbuffers::Verifiable for Referrer<'_> {
64 | #[inline]
65 | fn run_verifier(
66 | v: &mut flatbuffers::Verifier, pos: usize
67 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
68 | use self::flatbuffers::Verifiable;
69 | v.visit_table(pos)?
70 | .visit_field::>("guid", Self::VT_GUID, false)?
71 | .visit_field::>("name", Self::VT_NAME, false)?
72 | .finish();
73 | Ok(())
74 | }
75 | }
76 | pub struct ReferrerArgs<'a> {
77 | pub guid: Option>,
78 | pub name: Option>,
79 | }
80 | impl<'a> Default for ReferrerArgs<'a> {
81 | #[inline]
82 | fn default() -> Self {
83 | ReferrerArgs {
84 | guid: None,
85 | name: None,
86 | }
87 | }
88 | }
89 |
90 | pub struct ReferrerBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
91 | fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
92 | start_: flatbuffers::WIPOffset,
93 | }
94 | impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> ReferrerBuilder<'a, 'b, A> {
95 | #[inline]
96 | pub fn add_guid(&mut self, guid: flatbuffers::WIPOffset<&'b str>) {
97 | self.fbb_.push_slot_always::>(Referrer::VT_GUID, guid);
98 | }
99 | #[inline]
100 | pub fn add_name(&mut self, name: flatbuffers::WIPOffset<&'b str>) {
101 | self.fbb_.push_slot_always::>(Referrer::VT_NAME, name);
102 | }
103 | #[inline]
104 | pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> ReferrerBuilder<'a, 'b, A> {
105 | let start = _fbb.start_table();
106 | ReferrerBuilder {
107 | fbb_: _fbb,
108 | start_: start,
109 | }
110 | }
111 | #[inline]
112 | pub fn finish(self) -> flatbuffers::WIPOffset> {
113 | let o = self.fbb_.end_table(self.start_);
114 | flatbuffers::WIPOffset::new(o.value())
115 | }
116 | }
117 |
118 | impl core::fmt::Debug for Referrer<'_> {
119 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
120 | let mut ds = f.debug_struct("Referrer");
121 | ds.field("guid", &self.guid());
122 | ds.field("name", &self.name());
123 | ds.finish()
124 | }
125 | }
126 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/type_bin/register_location_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | pub enum RegisterLocationOffset {}
13 | #[derive(Copy, Clone, PartialEq)]
14 |
15 | pub struct RegisterLocation<'a> {
16 | pub _tab: flatbuffers::Table<'a>,
17 | }
18 |
19 | impl<'a> flatbuffers::Follow<'a> for RegisterLocation<'a> {
20 | type Inner = RegisterLocation<'a>;
21 | #[inline]
22 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
23 | Self { _tab: flatbuffers::Table::new(buf, loc) }
24 | }
25 | }
26 |
27 | impl<'a> RegisterLocation<'a> {
28 | pub const VT_ID: flatbuffers::VOffsetT = 4;
29 |
30 | #[inline]
31 | pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
32 | RegisterLocation { _tab: table }
33 | }
34 | #[allow(unused_mut)]
35 | pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
36 | _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
37 | args: &'args RegisterLocationArgs
38 | ) -> flatbuffers::WIPOffset> {
39 | let mut builder = RegisterLocationBuilder::new(_fbb);
40 | builder.add_id(args.id);
41 | builder.finish()
42 | }
43 |
44 |
45 | #[inline]
46 | pub fn id(&self) -> u64 {
47 | // Safety:
48 | // Created from valid Table for this object
49 | // which contains a valid value in this slot
50 | unsafe { self._tab.get::(RegisterLocation::VT_ID, Some(0)).unwrap()}
51 | }
52 | }
53 |
54 | impl flatbuffers::Verifiable for RegisterLocation<'_> {
55 | #[inline]
56 | fn run_verifier(
57 | v: &mut flatbuffers::Verifier, pos: usize
58 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
59 | use self::flatbuffers::Verifiable;
60 | v.visit_table(pos)?
61 | .visit_field::("id", Self::VT_ID, false)?
62 | .finish();
63 | Ok(())
64 | }
65 | }
66 | pub struct RegisterLocationArgs {
67 | pub id: u64,
68 | }
69 | impl<'a> Default for RegisterLocationArgs {
70 | #[inline]
71 | fn default() -> Self {
72 | RegisterLocationArgs {
73 | id: 0,
74 | }
75 | }
76 | }
77 |
78 | pub struct RegisterLocationBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
79 | fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
80 | start_: flatbuffers::WIPOffset,
81 | }
82 | impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> RegisterLocationBuilder<'a, 'b, A> {
83 | #[inline]
84 | pub fn add_id(&mut self, id: u64) {
85 | self.fbb_.push_slot::(RegisterLocation::VT_ID, id, 0);
86 | }
87 | #[inline]
88 | pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> RegisterLocationBuilder<'a, 'b, A> {
89 | let start = _fbb.start_table();
90 | RegisterLocationBuilder {
91 | fbb_: _fbb,
92 | start_: start,
93 | }
94 | }
95 | #[inline]
96 | pub fn finish(self) -> flatbuffers::WIPOffset> {
97 | let o = self.fbb_.end_table(self.start_);
98 | flatbuffers::WIPOffset::new(o.value())
99 | }
100 | }
101 |
102 | impl core::fmt::Debug for RegisterLocation<'_> {
103 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
104 | let mut ds = f.debug_struct("RegisterLocation");
105 | ds.field("id", &self.id());
106 | ds.finish()
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/type_bin/stack_location_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | pub enum StackLocationOffset {}
13 | #[derive(Copy, Clone, PartialEq)]
14 |
15 | pub struct StackLocation<'a> {
16 | pub _tab: flatbuffers::Table<'a>,
17 | }
18 |
19 | impl<'a> flatbuffers::Follow<'a> for StackLocation<'a> {
20 | type Inner = StackLocation<'a>;
21 | #[inline]
22 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
23 | Self { _tab: flatbuffers::Table::new(buf, loc) }
24 | }
25 | }
26 |
27 | impl<'a> StackLocation<'a> {
28 | pub const VT_OFFSET: flatbuffers::VOffsetT = 4;
29 |
30 | #[inline]
31 | pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
32 | StackLocation { _tab: table }
33 | }
34 | #[allow(unused_mut)]
35 | pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
36 | _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
37 | args: &'args StackLocationArgs<'args>
38 | ) -> flatbuffers::WIPOffset> {
39 | let mut builder = StackLocationBuilder::new(_fbb);
40 | if let Some(x) = args.offset { builder.add_offset(x); }
41 | builder.finish()
42 | }
43 |
44 |
45 | #[inline]
46 | pub fn offset(&self) -> &'a BitOffset {
47 | // Safety:
48 | // Created from valid Table for this object
49 | // which contains a valid value in this slot
50 | unsafe { self._tab.get::(StackLocation::VT_OFFSET, None).unwrap()}
51 | }
52 | }
53 |
54 | impl flatbuffers::Verifiable for StackLocation<'_> {
55 | #[inline]
56 | fn run_verifier(
57 | v: &mut flatbuffers::Verifier, pos: usize
58 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
59 | use self::flatbuffers::Verifiable;
60 | v.visit_table(pos)?
61 | .visit_field::("offset", Self::VT_OFFSET, true)?
62 | .finish();
63 | Ok(())
64 | }
65 | }
66 | pub struct StackLocationArgs<'a> {
67 | pub offset: Option<&'a BitOffset>,
68 | }
69 | impl<'a> Default for StackLocationArgs<'a> {
70 | #[inline]
71 | fn default() -> Self {
72 | StackLocationArgs {
73 | offset: None, // required field
74 | }
75 | }
76 | }
77 |
78 | pub struct StackLocationBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
79 | fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
80 | start_: flatbuffers::WIPOffset,
81 | }
82 | impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> StackLocationBuilder<'a, 'b, A> {
83 | #[inline]
84 | pub fn add_offset(&mut self, offset: &BitOffset) {
85 | self.fbb_.push_slot_always::<&BitOffset>(StackLocation::VT_OFFSET, offset);
86 | }
87 | #[inline]
88 | pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> StackLocationBuilder<'a, 'b, A> {
89 | let start = _fbb.start_table();
90 | StackLocationBuilder {
91 | fbb_: _fbb,
92 | start_: start,
93 | }
94 | }
95 | #[inline]
96 | pub fn finish(self) -> flatbuffers::WIPOffset> {
97 | let o = self.fbb_.end_table(self.start_);
98 | self.fbb_.required(o, StackLocation::VT_OFFSET,"offset");
99 | flatbuffers::WIPOffset::new(o.value())
100 | }
101 | }
102 |
103 | impl core::fmt::Debug for StackLocation<'_> {
104 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
105 | let mut ds = f.debug_struct("StackLocation");
106 | ds.field("offset", &self.offset());
107 | ds.finish()
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/type_bin/structure_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | pub enum StructureOffset {}
13 | #[derive(Copy, Clone, PartialEq)]
14 |
15 | pub struct Structure<'a> {
16 | pub _tab: flatbuffers::Table<'a>,
17 | }
18 |
19 | impl<'a> flatbuffers::Follow<'a> for Structure<'a> {
20 | type Inner = Structure<'a>;
21 | #[inline]
22 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
23 | Self { _tab: flatbuffers::Table::new(buf, loc) }
24 | }
25 | }
26 |
27 | impl<'a> Structure<'a> {
28 | pub const VT_MEMBERS: flatbuffers::VOffsetT = 4;
29 |
30 | #[inline]
31 | pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
32 | Structure { _tab: table }
33 | }
34 | #[allow(unused_mut)]
35 | pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
36 | _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
37 | args: &'args StructureArgs<'args>
38 | ) -> flatbuffers::WIPOffset> {
39 | let mut builder = StructureBuilder::new(_fbb);
40 | if let Some(x) = args.members { builder.add_members(x); }
41 | builder.finish()
42 | }
43 |
44 |
45 | #[inline]
46 | pub fn members(&self) -> Option>>> {
47 | // Safety:
48 | // Created from valid Table for this object
49 | // which contains a valid value in this slot
50 | unsafe { self._tab.get::>>>(Structure::VT_MEMBERS, None)}
51 | }
52 | }
53 |
54 | impl flatbuffers::Verifiable for Structure<'_> {
55 | #[inline]
56 | fn run_verifier(
57 | v: &mut flatbuffers::Verifier, pos: usize
58 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
59 | use self::flatbuffers::Verifiable;
60 | v.visit_table(pos)?
61 | .visit_field::>>>("members", Self::VT_MEMBERS, false)?
62 | .finish();
63 | Ok(())
64 | }
65 | }
66 | pub struct StructureArgs<'a> {
67 | pub members: Option>>>>,
68 | }
69 | impl<'a> Default for StructureArgs<'a> {
70 | #[inline]
71 | fn default() -> Self {
72 | StructureArgs {
73 | members: None,
74 | }
75 | }
76 | }
77 |
78 | pub struct StructureBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
79 | fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
80 | start_: flatbuffers::WIPOffset,
81 | }
82 | impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> StructureBuilder<'a, 'b, A> {
83 | #[inline]
84 | pub fn add_members(&mut self, members: flatbuffers::WIPOffset>>>) {
85 | self.fbb_.push_slot_always::>(Structure::VT_MEMBERS, members);
86 | }
87 | #[inline]
88 | pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> StructureBuilder<'a, 'b, A> {
89 | let start = _fbb.start_table();
90 | StructureBuilder {
91 | fbb_: _fbb,
92 | start_: start,
93 | }
94 | }
95 | #[inline]
96 | pub fn finish(self) -> flatbuffers::WIPOffset> {
97 | let o = self.fbb_.end_table(self.start_);
98 | flatbuffers::WIPOffset::new(o.value())
99 | }
100 | }
101 |
102 | impl core::fmt::Debug for Structure<'_> {
103 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
104 | let mut ds = f.debug_struct("Structure");
105 | ds.field("members", &self.members());
106 | ds.finish()
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/type_bin/structure_member_modifiers_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | #[allow(non_upper_case_globals)]
13 | mod bitflags_structure_member_modifiers {
14 | flatbuffers::bitflags::bitflags! {
15 | #[derive(Default)]
16 | pub struct StructureMemberModifiers: u8 {
17 | const Internal = 1;
18 | const Flattened = 2;
19 | }
20 | }
21 | }
22 | pub use self::bitflags_structure_member_modifiers::StructureMemberModifiers;
23 |
24 | impl<'a> flatbuffers::Follow<'a> for StructureMemberModifiers {
25 | type Inner = Self;
26 | #[inline]
27 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
28 | let b = flatbuffers::read_scalar_at::(buf, loc);
29 | // Safety:
30 | // This is safe because we know bitflags is implemented with a repr transparent uint of the correct size.
31 | // from_bits_unchecked will be replaced by an equivalent but safe from_bits_retain in bitflags 2.0
32 | // https://github.com/bitflags/bitflags/issues/262
33 | Self::from_bits_unchecked(b)
34 | }
35 | }
36 |
37 | impl flatbuffers::Push for StructureMemberModifiers {
38 | type Output = StructureMemberModifiers;
39 | #[inline]
40 | unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
41 | flatbuffers::emplace_scalar::(dst, self.bits());
42 | }
43 | }
44 |
45 | impl flatbuffers::EndianScalar for StructureMemberModifiers {
46 | type Scalar = u8;
47 | #[inline]
48 | fn to_little_endian(self) -> u8 {
49 | self.bits().to_le()
50 | }
51 | #[inline]
52 | #[allow(clippy::wrong_self_convention)]
53 | fn from_little_endian(v: u8) -> Self {
54 | let b = u8::from_le(v);
55 | // Safety:
56 | // This is safe because we know bitflags is implemented with a repr transparent uint of the correct size.
57 | // from_bits_unchecked will be replaced by an equivalent but safe from_bits_retain in bitflags 2.0
58 | // https://github.com/bitflags/bitflags/issues/262
59 | unsafe { Self::from_bits_unchecked(b) }
60 | }
61 | }
62 |
63 | impl<'a> flatbuffers::Verifiable for StructureMemberModifiers {
64 | #[inline]
65 | fn run_verifier(
66 | v: &mut flatbuffers::Verifier, pos: usize
67 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
68 | use self::flatbuffers::Verifiable;
69 | u8::run_verifier(v, pos)
70 | }
71 | }
72 |
73 | impl flatbuffers::SimpleToVerifyInSlice for StructureMemberModifiers {}
74 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/type_bin/type_alignment_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
13 | pub const ENUM_MIN_TYPE_ALIGNMENT: u8 = 0;
14 | #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
15 | pub const ENUM_MAX_TYPE_ALIGNMENT: u8 = 2;
16 | #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
17 | #[allow(non_camel_case_types)]
18 | pub const ENUM_VALUES_TYPE_ALIGNMENT: [TypeAlignment; 3] = [
19 | TypeAlignment::NONE,
20 | TypeAlignment::AccessAlignment,
21 | TypeAlignment::FixedAlignment,
22 | ];
23 |
24 | #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
25 | #[repr(transparent)]
26 | pub struct TypeAlignment(pub u8);
27 | #[allow(non_upper_case_globals)]
28 | impl TypeAlignment {
29 | pub const NONE: Self = Self(0);
30 | pub const AccessAlignment: Self = Self(1);
31 | pub const FixedAlignment: Self = Self(2);
32 |
33 | pub const ENUM_MIN: u8 = 0;
34 | pub const ENUM_MAX: u8 = 2;
35 | pub const ENUM_VALUES: &'static [Self] = &[
36 | Self::NONE,
37 | Self::AccessAlignment,
38 | Self::FixedAlignment,
39 | ];
40 | /// Returns the variant's name or "" if unknown.
41 | pub fn variant_name(self) -> Option<&'static str> {
42 | match self {
43 | Self::NONE => Some("NONE"),
44 | Self::AccessAlignment => Some("AccessAlignment"),
45 | Self::FixedAlignment => Some("FixedAlignment"),
46 | _ => None,
47 | }
48 | }
49 | }
50 | impl core::fmt::Debug for TypeAlignment {
51 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
52 | if let Some(name) = self.variant_name() {
53 | f.write_str(name)
54 | } else {
55 | f.write_fmt(format_args!("", self.0))
56 | }
57 | }
58 | }
59 | impl<'a> flatbuffers::Follow<'a> for TypeAlignment {
60 | type Inner = Self;
61 | #[inline]
62 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
63 | let b = flatbuffers::read_scalar_at::(buf, loc);
64 | Self(b)
65 | }
66 | }
67 |
68 | impl flatbuffers::Push for TypeAlignment {
69 | type Output = TypeAlignment;
70 | #[inline]
71 | unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
72 | flatbuffers::emplace_scalar::(dst, self.0);
73 | }
74 | }
75 |
76 | impl flatbuffers::EndianScalar for TypeAlignment {
77 | type Scalar = u8;
78 | #[inline]
79 | fn to_little_endian(self) -> u8 {
80 | self.0.to_le()
81 | }
82 | #[inline]
83 | #[allow(clippy::wrong_self_convention)]
84 | fn from_little_endian(v: u8) -> Self {
85 | let b = u8::from_le(v);
86 | Self(b)
87 | }
88 | }
89 |
90 | impl<'a> flatbuffers::Verifiable for TypeAlignment {
91 | #[inline]
92 | fn run_verifier(
93 | v: &mut flatbuffers::Verifier, pos: usize
94 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
95 | use self::flatbuffers::Verifiable;
96 | u8::run_verifier(v, pos)
97 | }
98 | }
99 |
100 | impl flatbuffers::SimpleToVerifyInSlice for TypeAlignment {}
101 | pub struct TypeAlignmentUnionTableOffset {}
102 |
103 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/type_bin/type_class_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
13 | pub const ENUM_MIN_TYPE_CLASS: u8 = 0;
14 | #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
15 | pub const ENUM_MAX_TYPE_CLASS: u8 = 12;
16 | #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
17 | #[allow(non_camel_case_types)]
18 | pub const ENUM_VALUES_TYPE_CLASS: [TypeClass; 13] = [
19 | TypeClass::NONE,
20 | TypeClass::Void,
21 | TypeClass::Boolean,
22 | TypeClass::Integer,
23 | TypeClass::Character,
24 | TypeClass::Float,
25 | TypeClass::Pointer,
26 | TypeClass::Array,
27 | TypeClass::Structure,
28 | TypeClass::Enumeration,
29 | TypeClass::Union,
30 | TypeClass::Function,
31 | TypeClass::Referrer,
32 | ];
33 |
34 | #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
35 | #[repr(transparent)]
36 | pub struct TypeClass(pub u8);
37 | #[allow(non_upper_case_globals)]
38 | impl TypeClass {
39 | pub const NONE: Self = Self(0);
40 | pub const Void: Self = Self(1);
41 | pub const Boolean: Self = Self(2);
42 | pub const Integer: Self = Self(3);
43 | pub const Character: Self = Self(4);
44 | pub const Float: Self = Self(5);
45 | pub const Pointer: Self = Self(6);
46 | pub const Array: Self = Self(7);
47 | pub const Structure: Self = Self(8);
48 | pub const Enumeration: Self = Self(9);
49 | pub const Union: Self = Self(10);
50 | pub const Function: Self = Self(11);
51 | pub const Referrer: Self = Self(12);
52 |
53 | pub const ENUM_MIN: u8 = 0;
54 | pub const ENUM_MAX: u8 = 12;
55 | pub const ENUM_VALUES: &'static [Self] = &[
56 | Self::NONE,
57 | Self::Void,
58 | Self::Boolean,
59 | Self::Integer,
60 | Self::Character,
61 | Self::Float,
62 | Self::Pointer,
63 | Self::Array,
64 | Self::Structure,
65 | Self::Enumeration,
66 | Self::Union,
67 | Self::Function,
68 | Self::Referrer,
69 | ];
70 | /// Returns the variant's name or "" if unknown.
71 | pub fn variant_name(self) -> Option<&'static str> {
72 | match self {
73 | Self::NONE => Some("NONE"),
74 | Self::Void => Some("Void"),
75 | Self::Boolean => Some("Boolean"),
76 | Self::Integer => Some("Integer"),
77 | Self::Character => Some("Character"),
78 | Self::Float => Some("Float"),
79 | Self::Pointer => Some("Pointer"),
80 | Self::Array => Some("Array"),
81 | Self::Structure => Some("Structure"),
82 | Self::Enumeration => Some("Enumeration"),
83 | Self::Union => Some("Union"),
84 | Self::Function => Some("Function"),
85 | Self::Referrer => Some("Referrer"),
86 | _ => None,
87 | }
88 | }
89 | }
90 | impl core::fmt::Debug for TypeClass {
91 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
92 | if let Some(name) = self.variant_name() {
93 | f.write_str(name)
94 | } else {
95 | f.write_fmt(format_args!("", self.0))
96 | }
97 | }
98 | }
99 | impl<'a> flatbuffers::Follow<'a> for TypeClass {
100 | type Inner = Self;
101 | #[inline]
102 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
103 | let b = flatbuffers::read_scalar_at::(buf, loc);
104 | Self(b)
105 | }
106 | }
107 |
108 | impl flatbuffers::Push for TypeClass {
109 | type Output = TypeClass;
110 | #[inline]
111 | unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
112 | flatbuffers::emplace_scalar::(dst, self.0);
113 | }
114 | }
115 |
116 | impl flatbuffers::EndianScalar for TypeClass {
117 | type Scalar = u8;
118 | #[inline]
119 | fn to_little_endian(self) -> u8 {
120 | self.0.to_le()
121 | }
122 | #[inline]
123 | #[allow(clippy::wrong_self_convention)]
124 | fn from_little_endian(v: u8) -> Self {
125 | let b = u8::from_le(v);
126 | Self(b)
127 | }
128 | }
129 |
130 | impl<'a> flatbuffers::Verifiable for TypeClass {
131 | #[inline]
132 | fn run_verifier(
133 | v: &mut flatbuffers::Verifier, pos: usize
134 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
135 | use self::flatbuffers::Verifiable;
136 | u8::run_verifier(v, pos)
137 | }
138 | }
139 |
140 | impl flatbuffers::SimpleToVerifyInSlice for TypeClass {}
141 | pub struct TypeClassUnionTableOffset {}
142 |
143 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/type_bin/type_modifier_class_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
13 | pub const ENUM_MIN_TYPE_MODIFIER_CLASS: u8 = 0;
14 | #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
15 | pub const ENUM_MAX_TYPE_MODIFIER_CLASS: u8 = 4;
16 | #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
17 | #[allow(non_camel_case_types)]
18 | pub const ENUM_VALUES_TYPE_MODIFIER_CLASS: [TypeModifierClass; 5] = [
19 | TypeModifierClass::NONE,
20 | TypeModifierClass::ConstantModifierClass,
21 | TypeModifierClass::VolatileModifierClass,
22 | TypeModifierClass::DescriptorModifierClass,
23 | TypeModifierClass::MetadataModifierClass,
24 | ];
25 |
26 | #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
27 | #[repr(transparent)]
28 | pub struct TypeModifierClass(pub u8);
29 | #[allow(non_upper_case_globals)]
30 | impl TypeModifierClass {
31 | pub const NONE: Self = Self(0);
32 | pub const ConstantModifierClass: Self = Self(1);
33 | pub const VolatileModifierClass: Self = Self(2);
34 | pub const DescriptorModifierClass: Self = Self(3);
35 | pub const MetadataModifierClass: Self = Self(4);
36 |
37 | pub const ENUM_MIN: u8 = 0;
38 | pub const ENUM_MAX: u8 = 4;
39 | pub const ENUM_VALUES: &'static [Self] = &[
40 | Self::NONE,
41 | Self::ConstantModifierClass,
42 | Self::VolatileModifierClass,
43 | Self::DescriptorModifierClass,
44 | Self::MetadataModifierClass,
45 | ];
46 | /// Returns the variant's name or "" if unknown.
47 | pub fn variant_name(self) -> Option<&'static str> {
48 | match self {
49 | Self::NONE => Some("NONE"),
50 | Self::ConstantModifierClass => Some("ConstantModifierClass"),
51 | Self::VolatileModifierClass => Some("VolatileModifierClass"),
52 | Self::DescriptorModifierClass => Some("DescriptorModifierClass"),
53 | Self::MetadataModifierClass => Some("MetadataModifierClass"),
54 | _ => None,
55 | }
56 | }
57 | }
58 | impl core::fmt::Debug for TypeModifierClass {
59 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
60 | if let Some(name) = self.variant_name() {
61 | f.write_str(name)
62 | } else {
63 | f.write_fmt(format_args!("", self.0))
64 | }
65 | }
66 | }
67 | impl<'a> flatbuffers::Follow<'a> for TypeModifierClass {
68 | type Inner = Self;
69 | #[inline]
70 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
71 | let b = flatbuffers::read_scalar_at::(buf, loc);
72 | Self(b)
73 | }
74 | }
75 |
76 | impl flatbuffers::Push for TypeModifierClass {
77 | type Output = TypeModifierClass;
78 | #[inline]
79 | unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
80 | flatbuffers::emplace_scalar::(dst, self.0);
81 | }
82 | }
83 |
84 | impl flatbuffers::EndianScalar for TypeModifierClass {
85 | type Scalar = u8;
86 | #[inline]
87 | fn to_little_endian(self) -> u8 {
88 | self.0.to_le()
89 | }
90 | #[inline]
91 | #[allow(clippy::wrong_self_convention)]
92 | fn from_little_endian(v: u8) -> Self {
93 | let b = u8::from_le(v);
94 | Self(b)
95 | }
96 | }
97 |
98 | impl<'a> flatbuffers::Verifiable for TypeModifierClass {
99 | #[inline]
100 | fn run_verifier(
101 | v: &mut flatbuffers::Verifier, pos: usize
102 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
103 | use self::flatbuffers::Verifiable;
104 | u8::run_verifier(v, pos)
105 | }
106 | }
107 |
108 | impl flatbuffers::SimpleToVerifyInSlice for TypeModifierClass {}
109 | pub struct TypeModifierClassUnionTableOffset {}
110 |
111 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/type_bin/union_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | pub enum UnionOffset {}
13 | #[derive(Copy, Clone, PartialEq)]
14 |
15 | pub struct Union<'a> {
16 | pub _tab: flatbuffers::Table<'a>,
17 | }
18 |
19 | impl<'a> flatbuffers::Follow<'a> for Union<'a> {
20 | type Inner = Union<'a>;
21 | #[inline]
22 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
23 | Self { _tab: flatbuffers::Table::new(buf, loc) }
24 | }
25 | }
26 |
27 | impl<'a> Union<'a> {
28 | pub const VT_MEMBERS: flatbuffers::VOffsetT = 4;
29 |
30 | #[inline]
31 | pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
32 | Union { _tab: table }
33 | }
34 | #[allow(unused_mut)]
35 | pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
36 | _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
37 | args: &'args UnionArgs<'args>
38 | ) -> flatbuffers::WIPOffset> {
39 | let mut builder = UnionBuilder::new(_fbb);
40 | if let Some(x) = args.members { builder.add_members(x); }
41 | builder.finish()
42 | }
43 |
44 |
45 | #[inline]
46 | pub fn members(&self) -> Option>>> {
47 | // Safety:
48 | // Created from valid Table for this object
49 | // which contains a valid value in this slot
50 | unsafe { self._tab.get::>>>(Union::VT_MEMBERS, None)}
51 | }
52 | }
53 |
54 | impl flatbuffers::Verifiable for Union<'_> {
55 | #[inline]
56 | fn run_verifier(
57 | v: &mut flatbuffers::Verifier, pos: usize
58 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
59 | use self::flatbuffers::Verifiable;
60 | v.visit_table(pos)?
61 | .visit_field::>>>("members", Self::VT_MEMBERS, false)?
62 | .finish();
63 | Ok(())
64 | }
65 | }
66 | pub struct UnionArgs<'a> {
67 | pub members: Option>>>>,
68 | }
69 | impl<'a> Default for UnionArgs<'a> {
70 | #[inline]
71 | fn default() -> Self {
72 | UnionArgs {
73 | members: None,
74 | }
75 | }
76 | }
77 |
78 | pub struct UnionBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
79 | fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
80 | start_: flatbuffers::WIPOffset,
81 | }
82 | impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> UnionBuilder<'a, 'b, A> {
83 | #[inline]
84 | pub fn add_members(&mut self, members: flatbuffers::WIPOffset>>>) {
85 | self.fbb_.push_slot_always::>(Union::VT_MEMBERS, members);
86 | }
87 | #[inline]
88 | pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> UnionBuilder<'a, 'b, A> {
89 | let start = _fbb.start_table();
90 | UnionBuilder {
91 | fbb_: _fbb,
92 | start_: start,
93 | }
94 | }
95 | #[inline]
96 | pub fn finish(self) -> flatbuffers::WIPOffset> {
97 | let o = self.fbb_.end_table(self.start_);
98 | flatbuffers::WIPOffset::new(o.value())
99 | }
100 | }
101 |
102 | impl core::fmt::Debug for Union<'_> {
103 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
104 | let mut ds = f.debug_struct("Union");
105 | ds.field("members", &self.members());
106 | ds.finish()
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/type_bin/union_member_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | pub enum UnionMemberOffset {}
13 | #[derive(Copy, Clone, PartialEq)]
14 |
15 | pub struct UnionMember<'a> {
16 | pub _tab: flatbuffers::Table<'a>,
17 | }
18 |
19 | impl<'a> flatbuffers::Follow<'a> for UnionMember<'a> {
20 | type Inner = UnionMember<'a>;
21 | #[inline]
22 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
23 | Self { _tab: flatbuffers::Table::new(buf, loc) }
24 | }
25 | }
26 |
27 | impl<'a> UnionMember<'a> {
28 | pub const VT_NAME: flatbuffers::VOffsetT = 4;
29 | pub const VT_TYPE_: flatbuffers::VOffsetT = 6;
30 |
31 | #[inline]
32 | pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
33 | UnionMember { _tab: table }
34 | }
35 | #[allow(unused_mut)]
36 | pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
37 | _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
38 | args: &'args UnionMemberArgs<'args>
39 | ) -> flatbuffers::WIPOffset> {
40 | let mut builder = UnionMemberBuilder::new(_fbb);
41 | if let Some(x) = args.type_ { builder.add_type_(x); }
42 | if let Some(x) = args.name { builder.add_name(x); }
43 | builder.finish()
44 | }
45 |
46 |
47 | #[inline]
48 | pub fn name(&self) -> Option<&'a str> {
49 | // Safety:
50 | // Created from valid Table for this object
51 | // which contains a valid value in this slot
52 | unsafe { self._tab.get::>(UnionMember::VT_NAME, None)}
53 | }
54 | #[inline]
55 | pub fn type_(&self) -> Type<'a> {
56 | // Safety:
57 | // Created from valid Table for this object
58 | // which contains a valid value in this slot
59 | unsafe { self._tab.get::>(UnionMember::VT_TYPE_, None).unwrap()}
60 | }
61 | }
62 |
63 | impl flatbuffers::Verifiable for UnionMember<'_> {
64 | #[inline]
65 | fn run_verifier(
66 | v: &mut flatbuffers::Verifier, pos: usize
67 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
68 | use self::flatbuffers::Verifiable;
69 | v.visit_table(pos)?
70 | .visit_field::>("name", Self::VT_NAME, false)?
71 | .visit_field::>("type_", Self::VT_TYPE_, true)?
72 | .finish();
73 | Ok(())
74 | }
75 | }
76 | pub struct UnionMemberArgs<'a> {
77 | pub name: Option>,
78 | pub type_: Option>>,
79 | }
80 | impl<'a> Default for UnionMemberArgs<'a> {
81 | #[inline]
82 | fn default() -> Self {
83 | UnionMemberArgs {
84 | name: None,
85 | type_: None, // required field
86 | }
87 | }
88 | }
89 |
90 | pub struct UnionMemberBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
91 | fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
92 | start_: flatbuffers::WIPOffset,
93 | }
94 | impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> UnionMemberBuilder<'a, 'b, A> {
95 | #[inline]
96 | pub fn add_name(&mut self, name: flatbuffers::WIPOffset<&'b str>) {
97 | self.fbb_.push_slot_always::>(UnionMember::VT_NAME, name);
98 | }
99 | #[inline]
100 | pub fn add_type_(&mut self, type_: flatbuffers::WIPOffset>) {
101 | self.fbb_.push_slot_always::>(UnionMember::VT_TYPE_, type_);
102 | }
103 | #[inline]
104 | pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> UnionMemberBuilder<'a, 'b, A> {
105 | let start = _fbb.start_table();
106 | UnionMemberBuilder {
107 | fbb_: _fbb,
108 | start_: start,
109 | }
110 | }
111 | #[inline]
112 | pub fn finish(self) -> flatbuffers::WIPOffset> {
113 | let o = self.fbb_.end_table(self.start_);
114 | self.fbb_.required(o, UnionMember::VT_TYPE_,"type_");
115 | flatbuffers::WIPOffset::new(o.value())
116 | }
117 | }
118 |
119 | impl core::fmt::Debug for UnionMember<'_> {
120 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
121 | let mut ds = f.debug_struct("UnionMember");
122 | ds.field("name", &self.name());
123 | ds.field("type_", &self.type_());
124 | ds.finish()
125 | }
126 | }
127 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/type_bin/unsigned_bit_offset_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | // struct UnsignedBitOffset, aligned to 8
13 | #[repr(transparent)]
14 | #[derive(Clone, Copy, PartialEq)]
15 | pub struct UnsignedBitOffset(pub [u8; 8]);
16 | impl Default for UnsignedBitOffset {
17 | fn default() -> Self {
18 | Self([0; 8])
19 | }
20 | }
21 | impl core::fmt::Debug for UnsignedBitOffset {
22 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
23 | f.debug_struct("UnsignedBitOffset")
24 | .field("value", &self.value())
25 | .finish()
26 | }
27 | }
28 |
29 | impl flatbuffers::SimpleToVerifyInSlice for UnsignedBitOffset {}
30 | impl<'a> flatbuffers::Follow<'a> for UnsignedBitOffset {
31 | type Inner = &'a UnsignedBitOffset;
32 | #[inline]
33 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
34 | <&'a UnsignedBitOffset>::follow(buf, loc)
35 | }
36 | }
37 | impl<'a> flatbuffers::Follow<'a> for &'a UnsignedBitOffset {
38 | type Inner = &'a UnsignedBitOffset;
39 | #[inline]
40 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
41 | flatbuffers::follow_cast_ref::(buf, loc)
42 | }
43 | }
44 | impl<'b> flatbuffers::Push for UnsignedBitOffset {
45 | type Output = UnsignedBitOffset;
46 | #[inline]
47 | unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
48 | let src = ::core::slice::from_raw_parts(self as *const UnsignedBitOffset as *const u8, Self::size());
49 | dst.copy_from_slice(src);
50 | }
51 | }
52 |
53 | impl<'a> flatbuffers::Verifiable for UnsignedBitOffset {
54 | #[inline]
55 | fn run_verifier(
56 | v: &mut flatbuffers::Verifier, pos: usize
57 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
58 | use self::flatbuffers::Verifiable;
59 | v.in_buffer::(pos)
60 | }
61 | }
62 |
63 | impl<'a> UnsignedBitOffset {
64 | #[allow(clippy::too_many_arguments)]
65 | pub fn new(
66 | value: u64,
67 | ) -> Self {
68 | let mut s = Self([0; 8]);
69 | s.set_value(value);
70 | s
71 | }
72 |
73 | pub fn value(&self) -> u64 {
74 | let mut mem = core::mem::MaybeUninit::<::Scalar>::uninit();
75 | // Safety:
76 | // Created from a valid Table for this object
77 | // Which contains a valid value in this slot
78 | EndianScalar::from_little_endian(unsafe {
79 | core::ptr::copy_nonoverlapping(
80 | self.0[0..].as_ptr(),
81 | mem.as_mut_ptr() as *mut u8,
82 | core::mem::size_of::<::Scalar>(),
83 | );
84 | mem.assume_init()
85 | })
86 | }
87 |
88 | pub fn set_value(&mut self, x: u64) {
89 | let x_le = x.to_little_endian();
90 | // Safety:
91 | // Created from a valid Table for this object
92 | // Which contains a valid value in this slot
93 | unsafe {
94 | core::ptr::copy_nonoverlapping(
95 | &x_le as *const _ as *const u8,
96 | self.0[0..].as_mut_ptr(),
97 | core::mem::size_of::<::Scalar>(),
98 | );
99 | }
100 | }
101 |
102 | }
103 |
104 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/type_bin/void_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | pub enum VoidOffset {}
13 | #[derive(Copy, Clone, PartialEq)]
14 |
15 | pub struct Void<'a> {
16 | pub _tab: flatbuffers::Table<'a>,
17 | }
18 |
19 | impl<'a> flatbuffers::Follow<'a> for Void<'a> {
20 | type Inner = Void<'a>;
21 | #[inline]
22 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
23 | Self { _tab: flatbuffers::Table::new(buf, loc) }
24 | }
25 | }
26 |
27 | impl<'a> Void<'a> {
28 |
29 | #[inline]
30 | pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
31 | Void { _tab: table }
32 | }
33 | #[allow(unused_mut)]
34 | pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
35 | _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
36 | _args: &'args VoidArgs
37 | ) -> flatbuffers::WIPOffset> {
38 | let mut builder = VoidBuilder::new(_fbb);
39 | builder.finish()
40 | }
41 |
42 | }
43 |
44 | impl flatbuffers::Verifiable for Void<'_> {
45 | #[inline]
46 | fn run_verifier(
47 | v: &mut flatbuffers::Verifier, pos: usize
48 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
49 | use self::flatbuffers::Verifiable;
50 | v.visit_table(pos)?
51 | .finish();
52 | Ok(())
53 | }
54 | }
55 | pub struct VoidArgs {
56 | }
57 | impl<'a> Default for VoidArgs {
58 | #[inline]
59 | fn default() -> Self {
60 | VoidArgs {
61 | }
62 | }
63 | }
64 |
65 | pub struct VoidBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
66 | fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
67 | start_: flatbuffers::WIPOffset,
68 | }
69 | impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> VoidBuilder<'a, 'b, A> {
70 | #[inline]
71 | pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> VoidBuilder<'a, 'b, A> {
72 | let start = _fbb.start_table();
73 | VoidBuilder {
74 | fbb_: _fbb,
75 | start_: start,
76 | }
77 | }
78 | #[inline]
79 | pub fn finish(self) -> flatbuffers::WIPOffset> {
80 | let o = self.fbb_.end_table(self.start_);
81 | flatbuffers::WIPOffset::new(o.value())
82 | }
83 | }
84 |
85 | impl core::fmt::Debug for Void<'_> {
86 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
87 | let mut ds = f.debug_struct("Void");
88 | ds.finish()
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/rust/gen_flatbuffers/type_bin/volatile_modifier_class_generated.rs:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 | // @generated
3 | extern crate alloc;
4 | extern crate flatbuffers;
5 | use alloc::boxed::Box;
6 | use alloc::string::{String, ToString};
7 | use alloc::vec::Vec;
8 | use core::mem;
9 | use core::cmp::Ordering;
10 | use self::flatbuffers::{EndianScalar, Follow};
11 | use super::*;
12 | pub enum VolatileModifierClassOffset {}
13 | #[derive(Copy, Clone, PartialEq)]
14 |
15 | pub struct VolatileModifierClass<'a> {
16 | pub _tab: flatbuffers::Table<'a>,
17 | }
18 |
19 | impl<'a> flatbuffers::Follow<'a> for VolatileModifierClass<'a> {
20 | type Inner = VolatileModifierClass<'a>;
21 | #[inline]
22 | unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
23 | Self { _tab: flatbuffers::Table::new(buf, loc) }
24 | }
25 | }
26 |
27 | impl<'a> VolatileModifierClass<'a> {
28 |
29 | #[inline]
30 | pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
31 | VolatileModifierClass { _tab: table }
32 | }
33 | #[allow(unused_mut)]
34 | pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
35 | _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
36 | _args: &'args VolatileModifierClassArgs
37 | ) -> flatbuffers::WIPOffset> {
38 | let mut builder = VolatileModifierClassBuilder::new(_fbb);
39 | builder.finish()
40 | }
41 |
42 | }
43 |
44 | impl flatbuffers::Verifiable for VolatileModifierClass<'_> {
45 | #[inline]
46 | fn run_verifier(
47 | v: &mut flatbuffers::Verifier, pos: usize
48 | ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
49 | use self::flatbuffers::Verifiable;
50 | v.visit_table(pos)?
51 | .finish();
52 | Ok(())
53 | }
54 | }
55 | pub struct VolatileModifierClassArgs {
56 | }
57 | impl<'a> Default for VolatileModifierClassArgs {
58 | #[inline]
59 | fn default() -> Self {
60 | VolatileModifierClassArgs {
61 | }
62 | }
63 | }
64 |
65 | pub struct VolatileModifierClassBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
66 | fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
67 | start_: flatbuffers::WIPOffset,
68 | }
69 | impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> VolatileModifierClassBuilder<'a, 'b, A> {
70 | #[inline]
71 | pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> VolatileModifierClassBuilder<'a, 'b, A> {
72 | let start = _fbb.start_table();
73 | VolatileModifierClassBuilder {
74 | fbb_: _fbb,
75 | start_: start,
76 | }
77 | }
78 | #[inline]
79 | pub fn finish(self) -> flatbuffers::WIPOffset> {
80 | let o = self.fbb_.end_table(self.start_);
81 | flatbuffers::WIPOffset::new(o.value())
82 | }
83 | }
84 |
85 | impl core::fmt::Debug for VolatileModifierClass<'_> {
86 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
87 | let mut ds = f.debug_struct("VolatileModifierClass");
88 | ds.finish()
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/rust/lib.rs:
--------------------------------------------------------------------------------
1 | pub mod signature;
2 | pub mod symbol;
3 | pub mod r#type;
4 |
5 | #[allow(warnings)]
6 | #[rustfmt::skip]
7 | mod gen_flatbuffers;
8 |
9 | use gen_flatbuffers::sig_bin as fb_sig;
10 | use gen_flatbuffers::symbol_bin as fb_symbol;
11 | use gen_flatbuffers::type_bin as fb_type;
12 |
13 | impl From for gen_flatbuffers::type_bin::BitWidth {
14 | fn from(value: u16) -> Self {
15 | Self::new(value)
16 | }
17 | }
18 |
19 | impl From<&gen_flatbuffers::type_bin::BitWidth> for u16 {
20 | fn from(value: &gen_flatbuffers::type_bin::BitWidth) -> Self {
21 | value.value()
22 | }
23 | }
24 |
25 | impl From for gen_flatbuffers::type_bin::BitSize {
26 | fn from(value: u64) -> Self {
27 | Self::new(value)
28 | }
29 | }
30 |
31 | impl From<&gen_flatbuffers::type_bin::BitSize> for u64 {
32 | fn from(value: &gen_flatbuffers::type_bin::BitSize) -> Self {
33 | value.value()
34 | }
35 | }
36 |
37 | impl From for gen_flatbuffers::type_bin::UnsignedBitOffset {
38 | fn from(value: u64) -> Self {
39 | Self::new(value)
40 | }
41 | }
42 |
43 | impl From<&gen_flatbuffers::type_bin::UnsignedBitOffset> for u64 {
44 | fn from(value: &gen_flatbuffers::type_bin::UnsignedBitOffset) -> Self {
45 | value.value()
46 | }
47 | }
48 |
49 | impl From for gen_flatbuffers::type_bin::BitOffset {
50 | fn from(value: i64) -> Self {
51 | Self::new(value)
52 | }
53 | }
54 |
55 | impl From<&gen_flatbuffers::type_bin::BitOffset> for i64 {
56 | fn from(value: &gen_flatbuffers::type_bin::BitOffset) -> Self {
57 | value.value()
58 | }
59 | }
60 |
61 | impl From for gen_flatbuffers::type_bin::BitShift {
62 | fn from(value: i64) -> Self {
63 | Self::new(value)
64 | }
65 | }
66 |
67 | impl From<&gen_flatbuffers::type_bin::BitShift> for i64 {
68 | fn from(value: &gen_flatbuffers::type_bin::BitShift) -> Self {
69 | value.value()
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/rust/signature/basic_block.rs:
--------------------------------------------------------------------------------
1 | use crate::fb_sig as fb;
2 | use flatbuffers::{FlatBufferBuilder, WIPOffset};
3 | use std::fmt::{Display, Formatter};
4 | use std::str::FromStr;
5 | use uuid::uuid;
6 | use uuid::Uuid;
7 |
8 | pub const NAMESPACE_BASICBLOCK: Uuid = uuid!("0192a178-7a5f-7936-8653-3cbaa7d6afe7");
9 |
10 | #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
11 | pub struct BasicBlockGUID {
12 | guid: Uuid,
13 | }
14 |
15 | impl BasicBlockGUID {
16 | pub fn as_bytes(&self) -> &[u8] {
17 | self.guid.as_bytes()
18 | }
19 | }
20 |
21 | impl FromStr for BasicBlockGUID {
22 | type Err = uuid::Error;
23 |
24 | fn from_str(s: &str) -> Result