Squashed 'third_party/flatbuffers/' changes from acc9990ab..d6a8dbd26
d6a8dbd26 Experimental fix for failing oss-fuzz coverage build (#6259)
ed391e177 BREAKING: Rust flexbuffers serde human readable set to false (#6257)
a49531414 Update to flags in fuzzing-cmake file (#6256)
de1f0342c Remove _POSIX_C_SOURCE and _XOPEN_SOURCE definitions when compiling o… (#6205)
d0d51e2a5 flatc should support --binary --schema with optional scalar fields. (#6252)
33ab26017 Bump version of rules_go to 0.24.5 (#6234)
febb9d87c Union As Accessors for C# (#6251)
8778dc7c2 Resets buffer without deallocating current pointer (#6247)
aae376e9a Add GetBufferSpan() function to bufferbuilder (#6235)
0ff047148 Modernize android build and sample (#6229)
46a8c7e95 Added required-nested-flatbuffer to monster_test and fixed rust (#6236)
bc56c553e Notify based on Labelling issues and PR (#6241)
07d7cd78a Converted globs to use single quotes (#6240)
cdef70e24 More adjustments to the auto labeler (#6239)
9dd44df35 Updated Lua labeller glob (#6238)
c9b29d088 Support size-prefixed buffers and add tests for size-prefixed messages (#6232)
fba93e0ab Removes duplicate swift in labeler (#6228)
d1a545b1f Added more labels for auto labeler (#6227)
ea92a668d [C#] Optional Scalars (#6217)
6034de286 [Label Bot] Add Java and Kotlin support for the label bot (#6226)
b08b0a440 Implement `Debug` trait for Rust flatbuffers. (#6207)
17ae48dec [Label Bot] Adds some languages to labeler bot (#6222)
fc8097925 Auto Labeler Setup, Just C# for now (#6221)
55658f523 Auto Labeler Setup, Just C# for now (#6218)
14ecfe423 Updated comments and fixed a fundamental type error. (#6214)
a0182cdb1 optional scalars for ts/js (#6215)
0dfcc0a37 Adds NetTest.bat to run .NET Core tests on Windows (#6216)
f9a18ea63 [Java] Implement optional scalars (#6212)
c7586e85a Empties the sharedString map on reset on go and csharp (#6187)
914c64601 Removed C# references from java generator. Move annotations closer to definitions (#6204)
42d7c7997 Adds readable size to asserts in read functions (#6210)
e68e8d7de Refactor idl_gen_rust (#6206)
84809be7e Fix typo in flatbuffers::span declaration. (#6202)
1606fb637 Kotlin test optional enum (#6201)
fe8e3c7e5 Mass Refactoring to use `IsString` and other BASE_TYPE helpers (#6193)
8f6fa4b71 Updated SupportsAdvancedUnionFeatures to look out for string (#6190)
b46db38f5 [JS/TS] Rewrite flexbuffers JS to TS (#6148)
9fa1d2705 Rework enums in rust. (#6098)
a402b3aba idl_gen_json_schema Fix generation of arrays of enums (#6184)
0e1415b99 fix(go_test): remove deprecated grpc call (#6183)
5cd713710 Add generation of JSON Schema to library (#6165)
5be777e1d Bump junit from 4.12 to 4.13.1 in /grpc/tests (#6173)
a49d440ec Bump junit from 4.12 to 4.13.1 in /grpc (#6172)
4ec5e8db9 [C++] Add option to not generate direct copy methods. (#6166)
04bec23a3 Add Array initialization from struct constructor (#5865) (#6147)
77d57fd07 Cast to right type for reserved_ subtraction (#6167)
543c1bbeb Fixed rust nested flatbuffers for tables other than self (#6062)
cb971eece [C++] Fix -Wnarrowing and -Woverflow due to signed bitfields on G++ ARM (#6163)
7b9e61fcc [TS] GRPC Implementation (#6141)
3359e3042 Moved C++ to optional_scalars2 and added some tests. (#6162)
187a4787f [Rust] Upgrade flatbuffers library to 2018 edition (#6159)
08943aa26 Flatbuffer C++ UnpackTo optimization for vectors of non-bool bytes. (#6154)
5975658eb Enables optional enums in swift (#6160)
5d3cf440e Updated Lobster test for optional bools/enums
8ec8322f0 Ruopt enum (#6156)
bbcc85fd4 Fix generation of C++ code with Optional<Enum> (#6155)
0bdf2fa15 [C#] Fix and improve project files (#6142)
2eedc769d possibility to create a vector from an iterator (#6135)
ab01ae162 flatc should output a warning, when an attribute is attached more than once (#6146)
689bfafa7 [Python/JS/TS] Codegen SizeOf method for structs (#6136)
641309a5b unix2dos on tests/FlatBuffers.Test/FlatBuffers.Core.Test.csproj (#6133)
52e362879 SpanT is available in .Net Standard 2.0. (#6137)
dca12522a Add static cast to avoid implicit double promotion. (#6132)
e0bbaa6f9 [C#]Change to ENABLE_SPAN_T that doesn't require UNSAFE_BYTEBUFFER. (#6073)
ab139d6be Revert "[C#] Fix and improve project files (#6116)" (#6130)
34d67b425 Minireflect fixed array (#6129)
96d5e3597 [JS/TS] fix flatbuffers default export (#6123)
eb686a86f Add missed file generated by optional_scalar.fbs (#6125)
750281630 [C#] Fix and improve project files (#6116)
fb4e1c34f Add CharToLower and CharToUpper into util.s (#6126)
8c67b5b12 Add support of Optional<T> scalars to C++ code generator (#6092)
6228b66d3 [Kotlin] Support for optional scalars. (#6115)
e1be8aaad Bump version for latest swift version (#6121)
94873e595 [JS/TS] Modernize TypeScript / JavaScript flatbuffers support (#6095)
b8e87fafe [JS] Add getFullyQualifiedName() (#6119)
f96d1ef74 [Java] allowing larger buffer sizes when growing a byte buffer (#6118)
89435303b [Swift] Migrates struct write APIS to write directly to the buffer (#6093)
c75ae2429 Optional-ness in reflection (#6097)
338944d3d Rename Nullable scalars to Optional scalars (#6112)
f5ab24bc4 Avoid memcpy call for empty vectors (#6111)
92a8c1a0f [JS] FlexBuffers Fix for wrong type of offset and length values (#6107)
6cea45dcd fix c# json serializer commandline argument docs (#6104)
fec58aa12 Fix for issue 6100: incorrect shrinking logic in ResizeContext() (#6102)
71aca81ff [JS] FlexBuffers Support (#5973)
04d87ffec [C++] Small refactoring of the C++ code generator (#6091)
bb25956f0 Wrap verify file id condition in Check call (#6085)
49f4948f0 + Add `removable-media` plug to the snapcraft config (#6083)
eeacc53d2 Adds proper access types for swift object api & flatbuffers & grpc (#6081)
f3003e08d [Lobster] missed a test
d713a0084 [CMake] enabled multi-core builds in VS projects
77f966f89 [Lobster] optional scalars support
e86d5b8e9 [Kotlin] Attach JvmStatic annotation to each method in companion object (#6052)
db2aa9b4e [C#] Cleaned up .NET testing script for Mono (#6016)
63cc0eec4 Adds a serialize helper function to native table (#6059)
c30a87de6 [TS] Fix four bugs with imported types in TypeScript. (#6054)
a0fb30575 [Swift] Append namespace for Swift Grpc implementation (#6049)
77c18c1d6 export a __version__ variable for python module (#5309)
f1f23d08e adding fb import when no other imports are present (#6030)
f1025b284 [Feature] Checks for Nullable strings (#6050)
5d052f4e5 [Swift] RFC: Switch Swift namespace from public enum to ordinary concat with _ (#6045)
18b015d25 Rust codegen improvements and lint fixes (#6046)
d76e93f27 adds code gen for optional scalars in swift (#6038)
82fac326c [C++] Fix compiler error from deleted assignment operator (#6036) (#6047)
043b52bd4 Optional Scalars support for Rust (#6034)
c8fa0afdf Allow to run cpp tests under grpc/tests/ using bazel. (#6040)
6d0aae73c Fix git command executed in wrong folder when doing cmake superbuild (#6039)
ff1b73128 [Swift] Optional Scalars Preparation (#6028)
2e48c8dd3 tests: Check for both quiet and signaling NaN on mipsel/hppa (#6029)
6942704f2 support deprecated flag in json schema (#6022)
9ecd2e16c Flatc parser support for nullable scalars (#6026)
33e2d8079 [Dart] Generate constant values map for enums (#6025)
969d0f7a6 Using proper symbol name for reexport (#6021)
515a4052a Silence false positive "-Wstringop-overflow" on GCC 10.0 to 11.0 (#6020)
36fbe6f13 Updated FB import (#6019)
b69fc8cc9 [Java] Add support for shared strings on FlatBufferBuilder. (#6012)
ab6af18d9 Not using non-existent create method for obj api (#6015)
37a5dee10 Code cleanup + updates test and readme (#6004)
8a721f69a Serde with bytes maps to Blob (#6009)
e810635ea [Swift] FlatBuffers createMonster method doesn't treat struct properly (#5992)
4995e1527 Manage grpc dependency in Bazel's WORKSPACE file. (#5995)
60b6066fe Add warning to schema parser if field name is not snake_case. (#6005)
35d45cac7 [Rust] Flexbuffers dependency cleanup and fixes (#5998)
165a6e3d1 Re-added Evolution Schema Code Generation Command (#5999)
13d3fb2ea Fix RPM install conflict (#6003)
d64078eb2 [Swift] Initialize memory when clear ByteBuffer (#5982)
ca1190a3d [TS] Use proper TypedArray in create*Vector (#5991)
7571b2ac5 [C++] Updates real_path to be truly portable (#5787)
e5a8f76a4 [C++] Generate default member initializers for >= C++11 (#5989)
413bb9b55 [Kotlin] Fix Access to union of vector element (#5994)
f35184aef [Swift] Add parsing from unowned UnsafeMutableRawPointer for ByteBuffer (#5981)
b124b7625 Removed requirement that enums be declared in ascending order. (#5887)
0ec7600c6 Do not remove the last digit from float values (#5974)
14baf45c9 Mark GetBufferMinAlignment() const (#5985)
9abb2ec2c TypeScript/JavaScript docs improvements (#5984)
2e57d80b1 [Swift] Internal library improvements (#5965)
cfc7753a4 [Doc] Added missing letters to compiler options (#5976)
12ddc8a92 Rust Flexbuffers Documentation update (#5979)
24ad35709 [docs] typo: updates monsterdata.json to be valid json (#5978)
cc44a4442 [idl_parser] Mark typefield as deprecated (#5958)
9ab4a5c0e Deleted old stale bot
6682cfe87 Increased Operations per run in stale.yml
64922904b Adding Stale Action to clean up PR and Issues
8e505cb67 [C++] Fixed/Enabled --cpp-ptr-type std::shared_ptr [#5813] (#5959)
a28357d7a Propagate boolean default values from proto to fbs (#5964)
7cb4762a6 [Swift] Improving reallocation time by using memcpy and moving reallocation code to storage (#5960)
4e45f7c9e Fix error in SimpleQSort (#5955)
7ac026405 fix error on GRPC Python - ignore namespace tree if not specified (#5862) (#5922)
108e981db Required is now implemented in swift (#5952)
94a78e385 Fixed: Access violation and ASAN/UNSAN failures with sorted tables
53fb453e0 [rust] Add FlatBufferBuilder::force_defaults API (#5946)
17c1f35fa [FlexBuffer][Java] ReadWriteBuf and ReadBuf interface public (#5948)
2eaf57778 [Java] Grow ArrayReadWriteBuf enough to match requested capacity. (#5921)
666800da3 Adds bool support in structs + updates grpc support + CI upgrades (#5943)
38ed69eb3 fixed mutating inline values (#5942)
d026e6f07 Add static asserts to ensure that reflection API arrays are kept in sync (#5934)
988164f6e [C++] Got rid of memset's in constructors (#5938)
7179a5a8b General Codebase clean up (#5939)
a0da0c08c Add GetStringView like GetString, GetCstring (#5937)
ac203b209 [C#] Add file identifier to ObjectAPI Serialization Utility. (#5920)
8dd1bf25b not creating creation methods when using structs (#5919)
5aa443d98 [Dart] Adding FlexBuffers support (#5853)
0fa087657 [Dart] Getting tests/DartTest.sh to work on master. (#5915)
424a473e1 Schema parser: prohibit declaration of an array of pointers inside structs (#5907)
c3faa8346 Fix Cargo.toml dependencies (#5911)
91399ad05 fix union type names (#5902)
32782e4ad Update Rust Flexbuffers metadata before publishing (#5905)
e7f3b1690 [TS] Make Obj-API work with --short-names (#5898)
12ed1fe4a fixed invalid imports with --gen-all (#5895)
85ee4df7a [C#] Thread safe reads of Double and Float values from a ByteBuffer (#5900)
de89bd193 Implement flexbuffers in python (#5880)
8be05f6bd Rust Flexbuffers (#5669)
870ecbc09 [swift] Moves code to use VTablesStorage (#5888)
c2da8d5d8 [Java][FlexBuffers] Make FlexBuffersBuilder reusable by adding clear() (#5889) (#5890)
e84cbff67 Align package name to FindFlatBuffers.cmake (#5899)
f94e6c84e Small tutorial improvements - documentation only (#5894)
f12cca8bc Attempt at adding Github Actions CI
7e4124d6e Handle git program or .git folder absence (#5878)
a875d247a only add native_include_files if object based api is enabled (#5886)
6e9f5d981 Respect shared attribute in Parser (#5885)
ff1c78233 include/flatbuffers: typo fixes in comments (#5884)
2e9a19673 Updates swift docs for package management (#5883)
e3cb07d32 [Rust] idl_gen_rust.cpp: (Option/required-aware codegen for unions) (#5850)
712866d57 Propagate use_string_pooling in CopyTable (#5879)
44c919a9e Not using reexports with --gen-all (#5873)
99aa1ef21 Added INCLUDE_PREFIX option for flatbuffers_generate_headers (#5866)
40ba170c9 Fixed text in internals doc that implied structs can be root
cb4d0f72e [Swift] Object API support (#5826)
003e16405 [TS] Add Obj API (#5788)
21cf300f4 fix cpp usage markdown error (#5845)
9655e12d6 Upgraded swift implementation for grpc (#5843)
fb96fadc2 [C#] Fix nested structs and arrays in Object API (#5765)
408f11fbd [ts] Fix empty source/dest namespaces when reexporting. (#5841)
a83caf591 Improves performance for the swift library by using structs + a storage class (#5835)
925fab6b1 [Java][FlexBuffers] Optimize Map access (#5735)
d9fecc332 [CMake] : Add precompiled header support with FLATBUFFERS_ENABLE_PCH (#5827)
e9d453240 Added flatbuffers_generate_headers and flatbuffers_generate_binary_files cmake functions. (#5830)
c37c989ed Correct calculation of vector element size (#5831)
6b271b7ec Fix Clang-trunk warnings about special members deprecated in C++20. (#5829)
90f3b8e8c Fix `float_constant` definition in './doc/Grammar.md` (#5828)
3af735934 [csharp] flatc should generate a 'Create…' method for tables with struct field… (#5818)
c4231c3cb Updated doxyfile - added missing files (#5824)
9657df184 Update Grammar.md (#5820)
97ffc590e Include CPack only when explictly packaging (#5817)
8b52af65b [C++] Add max_depth and max_tables parameters to reflection::Verify (#5815)
9b034eee1 Fix interpretation of 'nan(number)' by the idl_parser (#5810)
3e9ac3cff [Scripts] Adds swift to generated code (#5806)
697147a2e updated maven build files
6df40a247 pre-tag version bump for 1.12
0dba63909 Removes the inner loop in the endtable check written tables (#5803)
0e3fdd0ee Escape characters in jsonschema descriptions (#5644)
45a2b07cb Remove `noexcept` qualifier copy-ctor of `union` type (#5800) (#5802)
d10c16314 Replace 'assert' by 'FLATBUFFERS_ASSERT' inside idl_parser.cpp (#5799)
35abb7f89 Add non-nullable modifier to return type of functions never returning null (#5797)
9954e09ab [C++] Generate code for vector force_align attribute. (#5796)
95a21327f rust: pub export the VectorIter type (#5736)
89b6183ee Fix Python min alignment
5a98d65e8 [Rust] Add gen-name-strings for Rust (#5757)
f73d205bc Removed assert that wasn't backwards compatible.
7c37abe92 [C#] add ObjectAPI Serialization Utility (#5785)
4749e77b0 Fixed docs on how to obtain parser error.
6ff189841 Added --filename-suffix and --filename-ext to flatc (#5778)
c9a30c9ca Fixed refractoring issue in reflection/generate_code.sh. Also, mv deletes the original file, so I don't need to clean it up manually in that case. (#5777)
8c02d17be Skip writing reflection_generated.h if not changed (#5776)
34305c4ce [Swift] Adds GRPC to Swift (#5758)
cd88e6b2a [Java][FlexBuffers] Abstract buffer access from ByteBuffer (#5743)
3ec7a53c6 Adds cocoapods and a readme of how to get the package (#5771)
6d44cede7 [snap] Fix versioning (#5727)
cc08c0835 [Python] Fixed potential allignment issue (#5768)
54f8b787c Fix memory leak on cpp object api (#5761)
17557f913 [Python] Fixed issue #5499 (#5764)
d54af8cd4 [C++] Use strong enum type for vectors when scoped-enums is on. (#5750)
173e10fdf [C#] support Json Serialization (#5752)
8f56990f6 FlexBuffers: C++: scalar-only typed vectors were not aligned.
6400c9b05 Bump Rust port to 0.6.1 (#5747)
7418d8587 [C#] support Object API (#5710)
c580fa284 Adds min and max, comments, and all of swift's keywords + fix docs (#5737)
f2a127230 Use VS 2017 and 2019 on CI, fix cast issue in dart_idl (#5740)
316d7c208 Creates a flatbuffers validation function + small fix (#5725)
47026ea6b Added the code to embed the binary schema to the source (--bfbs-gen-embed). (#5701)
3f677f241 [Java][FlexBuffers] Deprecate typed vector strings due to design flaw (#5722)
a593a11e5 [Go] Implements a SharedStrings function (#5733)
7cdfc8475 [Swift] Fix padding function overflow when bufSize is 0 (#5721)
bab2b0db4 Add vcpkg installation instructions (#5732)
89418eb84 [Dart] Fix deprecated field support, inf/nan (#5724)
9cadf05d8 [typescript] Size-prefixed root accessors not taking into account size prefix (#5717)
6da1cf79d [rust] Add use declarations to Rust-generated bindings for imported FB definitions (#5645)
bee1df96d [Go] Replace references to hardcoded ”Monster" etc with idiomatic go wherever possible (#5716)
01189d7ed [C++] Fix for printing of enum in case output_enum_identifiers=1. (#5706)
c4b2b0a25 [Swift] Support create long string (#5709)
a4b2884e4 Added create function for swift (#5707)
04d80f255 [Swift] Swift implementation 🎉🎉 (#5603)
55686100a Changed direct calls to strtod to use StringToNumber
718351831 Document JSON compatibility guarantees. (#5704)
d1b34f0f2 Add CMake 'generated_code' target to simplify resolution of build dependencies (#5697)
21b706196 (Optionally) add an additional suffix namespace to generated fbs files. (#5698)
35daaf83d [Java] Replace Table.UTF8_CHARSET with StandardCharsets.UTF_8 (#5696)
3b458f7a1 Rust: Temporarily disable 2 endianness unit tests (#5695)
a5d9d0f7d [C++17] Add Traits class for Tables and Factory function within it. (#5678)
3cd9b6434 Removed code_generators.cpp from library targets
355dfd48d [rust] Make enum names public (#5690)
bcd58a159 Correct inverted logic around include prefixes. (#5689)
a2c12900a Optimize Pack method using numpy (#5662)
901b89e73 [C++] Add Builder and Table typedefs (#5685)
31f879908 Minor doc updates: FlexBuffers C#, Discord, CppUsage.
8023d99e2 Upgrade rules_go (#5684)
b4154405d Fix --incompatible_load_cc_rules_from_bzl (#5683)
04c17c7a7 Add support for absl::string_view when available (#5682)
62ec7d52c [Bazel] Add support for compatible_with and restricted_to (#5681)
7de668053 CI: New Docker tests for Python with numpy (#5677)
3a70e0b30 Fixed struct initialization error on older versions of C#
9b1320135 Fixed warnings in FlexBuffers.java
5e3916050 Fixed out of date licenses on gRPC Python files.
c95755051 Removed test proto output.
44bf71988 Add flatc '--cpp_std' switch (#5656)
3e8f15df9 Fix for FlexBuffers FBT_VECTOR_STRING size bit-width.
602721a73 Added Check to VerifyAlignment (#5675)
13c05f4da Improve import handling for proto conversion (#5673)
ce3a1c43a [Dart] Fix prepare space for writeListInt64 and writeListUint64 (#5654)
aa75e5734 Make Rust constants public (#5659)
2790fee25 Add namespace qualification to union types (#5666)
eddebec1b Bugfix for Rust generation of union fields named with language keywords (#5592)
030fee36a wrap multiple statements in do {} while(!IsConstTrue(true)) (#5655)
f9724d1bd [gRPC] Uncomment MessageBuilder (#5658)
b20801ca4 Supress unsigned-integer-overflow for PaddingBytes (#5647)
a8e800bd7 Add --force-empty-vectors option (#5653)
d7530ae96 Fixed enum min/max values not properly escaped.
99d11e279 Split Bazel targets into multiple packages (#5640)
4fd8eb214 Remove a static_assert (#5643)
65f870357 Flatbuffers Python Object API (#5616)
75823cc27 [Clang 10]: definition of implicit copy constructor for 'TableKeyComparatoris deprecated #5649 (#5650)
58e279244 [docs]: add missing semicolon (#5648)
3c964e10a [GO] Fix support for enums with underscores and Unions with imported members (#5600)
c3c32ec94 Fix ambiguity of a type deduction in TEST_EQ macro if arguments have `enum class` type. (#5630)
075e8d676 Simplify declarations of x-macro FLATBUFFERS_TD (#5638)
bcf1bd5c9 read vtable size through ReadScalar() (#5636)
136d75fa6 Changed null checks in test. Removed verifier pointer usage (#5634)
091fa1fd1 Add testing of C++ with sanitizers (CI-Docker) (#5631)
ff3781dc2 add namespace prefix in FLATBUFFERS_MAX_BUFFER_SIZE (#5629)
6beb9f49c Support for python grpc - continuing the work from the pull request #4270 #4705 (#5613)
80988ea86 Removed idl_gen_general.cpp and move contents to code_generators.cpp (#5625)
0f2ff7eaa Lua cleanup (#5624)
dda095023 [C++] Adds basic schema evolution tests (#5611)
adbcbba5d [C++, C#, Java] Separated C# and Java generators into their own classes (#5618)
cbbd6aca0 add check for root_type specified for json schema generation (#5622)
405c64e07 [Rust] Bump smallvec version to 1.0 (#5621)
42c08cbca Ran src/clang-format-all.sh (#5617)
33d5dd9bd Improved pull request & clang-format instructions.
105dd528e Change monster_extra generation to use flatbuffers::unique_ptr (#5612)
f0f0efe7b [C++] Refactor to conform to Google C++ style guide (#5608)
e837d5a29 Fixed deprecated method in GRPC Java test.
9834ee978 Fixed Apache license not using canonical version.
44b2ab087 include/flatbuffers/base.h: fix no_sanitize issue with old clang (#5610)
46ae3f80a [C++, Java, C#, TypeScript, JavaScript] Skip generation of mutable union types (#5599)
7b38aa71e flatbuffers.h: fix documentation warning (#5607)
661bedd83 Add Lua FlatbufferBuilder Clean() method to enable reuseable builders (#5606)
8526e12d7 [Kotlin] Fix union vector accessor after change in Java API (#5605)
3c7b660d6 [flatc] Remove an always true condition for flexbuffers (#5604)
964365ba6 [Go] Add UnPackTo functions (#5598)
32254b7ac [Go] Object API support (#5339)
521e255ad Rust: Add idiomatic iterator for Vector type (#5579)
1b85292fd Fix typos in comments (#5590)
480815447 C++ verifier for evolved union fields should return true (#5586)
8d5e424c6 Add ByteBuffer copy for vector of bytes in Java (#5587)
b4774d235 Rust: Fix Copy and Clone impls for a few generic types (#5577)
26f238c24 Add `--clean-first` to the cmake-build command (travis) (#5574)
e93c8c46e Fix Follow implementation for bool (#5554)
e21516b9d Fix issue #5557 (#5573)
fbc11e8ae Avoid intentional unsigned integer overflow getting caught by sanitizers (#5572)
e9d29c21a Python: Add forceDefaults opt to python Builder (#5564)
8bfafc76d Java: Don't annotate vector-of-tables item getters with @nullable. (#5562)
df3e8bf4a Fixed warnings generated by recent JSON sorting feature.
5665cfe49 [Java] byte buffer factory returned buffer capcity is used instead of the requested size (#5558)
5797540ed #5544 Fix of Array of table is not sorted if Create<type>Direct() is used (#5546)
7f1af7cb0 Fix build with gcc version 7.4.0 (#5570)
32f47ad24 Fixed JSON parser not sorting vectors of tables/structs with key.
842f672ba [FlexBuffers][Java] Cache size of Sized objects in FlexBuffers (#5551)
d4cae0a62 Fix issue #5542 (#5543)
f1147f65b Fixed Android STLPort related error.
69d3fec48 Fix namespaced struct/field name collision detection (#5540) (#5545)
cfb4ecf6f [flac] Add FlexBuffers option for generating data (#5519)
a92039687 Update Rust versions under test from 1.30.1 to 1.37.0 (#5538)
625338d09 Adds XOPEN_SOURCE for PATH_MAX and POSIX 1993 for stat (#5529)
3f8ce99c5 [FlexBuffers][Java] Add override Key::toString (#5533)
0798b7b69 [FlexBuffers][Java] Fix wrong access to a string using Reference::asString(). (#5532)
cbdf82e2f Fix Mutate() methods of Array<scalar/struct> (override 5508) (#5526)
e365c502f Java: Added access object for vector of struct and vector of tables. (#5233)
97f3aa917 Fixed DetachedBuffer self move assignment (#5521)
2f5bb2eec Fix buildifier warnings found in new bazel (#5517)
917687c7a Fixed Reflection Verifier not handling vectors of unions.
f9277e691 Fixed GenerateText not handling vectors of unions.
2706381ee Add element size parameter to __vector_as_arraysegment [c#] (#5512)
b5560fcd5 [Java][FlexBuffers] Improve documentation for FlexBuffers in Java. (#5506)
782b865c5 Annotate getters with @Pure when --java-checkerframework is specified. (#5510)
3bfc86eaf [Dart]fix: segment fault with empty namespace when generating dart file (#5507)
c0282873f Rust: Fixed cargo clippy on non-generated code (#5485)
4b870aca9 [Javascript] Fix syntax error for signed enum (#5503)
d0e3870c0 [C#] Fix retrieving enumeration vectors as arrays (#5457)
fb25eb87f Doc typo fixes (#5505)
cb35d3a0e Use all of the available space in the buffer returned by ByteBufferFactory to allow the factory to keep a pool of larger than initialsize sized buffers. (#5500)
8e6cabb31 [FlexBuffers][Java] Implementation of FlexBuffers API (#5476)
bd31dd242 Clarified value reuse in FlexBuffers
65b67d213 Fixed test build invocation of arrays_test.fbs
1fbb71132 FlexBuffers: allow any values to be shared.
cd75a3658 Android: remove app_dummy() calls
ec6b0bf29 Fixed STLPort Android compile error
c11b5d744 [bugfix]flexbuffers isvector bugfix (#5488)
4525c91be Fix incorrect padding in arrays of structs (Issue #5484) (#5491)
b97b342f5 Fixed missing generated code.
c1058a903 C++ IDL generation adds superfluous semicolon in GenTablePost, causing (#5483)
303044934 [go]add Name() for ForceCodec interface (#5486)
a2485d4ec reflection: check for valid union enum value during object verification (#5475)
a20e71ac9 has_method support for primitive fields in java runtime. Changed: idl.h, FlatBufferBuilder.java , idl_gen_general.cpp, idl_parser.cpp, flatc.cpp (#5468)
Change-Id: I836f4b43e6818bb16425a87899e6234ac86242aa
git-subtree-dir: third_party/flatbuffers
git-subtree-split: d6a8dbd26ff08a8868e0d0c1b4b67d31b40e4a7f
diff --git a/tests/monster_test_generated.rs b/tests/monster_test_generated.rs
index 59bbf37..e653933 100644
--- a/tests/monster_test_generated.rs
+++ b/tests/monster_test_generated.rs
@@ -1,7 +1,10 @@
// automatically generated by the FlatBuffers compiler, do not modify
+#![allow(unused_imports, dead_code)]
+use crate::include_test1_generated::*;
+use crate::include_test2_generated::*;
use std::mem;
use std::cmp::Ordering;
@@ -11,6 +14,8 @@
#[allow(unused_imports, dead_code)]
pub mod my_game {
+ use crate::include_test1_generated::*;
+ use crate::include_test2_generated::*;
use std::mem;
use std::cmp::Ordering;
@@ -18,7 +23,7 @@
use self::flatbuffers::EndianScalar;
pub enum InParentNamespaceOffset {}
-#[derive(Copy, Clone, Debug, PartialEq)]
+#[derive(Copy, Clone, PartialEq)]
pub struct InParentNamespace<'a> {
pub _tab: flatbuffers::Table<'a>,
@@ -28,13 +33,15 @@
type Inner = InParentNamespace<'a>;
#[inline]
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
- Self {
- _tab: flatbuffers::Table { buf: buf, loc: loc },
- }
+ Self { _tab: flatbuffers::Table { buf, loc } }
}
}
impl<'a> InParentNamespace<'a> {
+ pub const fn get_fully_qualified_name() -> &'static str {
+ "MyGame.InParentNamespace"
+ }
+
#[inline]
pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
InParentNamespace {
@@ -80,9 +87,17 @@
}
}
+impl std::fmt::Debug for InParentNamespace<'_> {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ let mut ds = f.debug_struct("InParentNamespace");
+ ds.finish()
+ }
+}
#[allow(unused_imports, dead_code)]
pub mod example_2 {
+ use crate::include_test1_generated::*;
+ use crate::include_test2_generated::*;
use std::mem;
use std::cmp::Ordering;
@@ -90,7 +105,7 @@
use self::flatbuffers::EndianScalar;
pub enum MonsterOffset {}
-#[derive(Copy, Clone, Debug, PartialEq)]
+#[derive(Copy, Clone, PartialEq)]
pub struct Monster<'a> {
pub _tab: flatbuffers::Table<'a>,
@@ -100,13 +115,15 @@
type Inner = Monster<'a>;
#[inline]
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
- Self {
- _tab: flatbuffers::Table { buf: buf, loc: loc },
- }
+ Self { _tab: flatbuffers::Table { buf, loc } }
}
}
impl<'a> Monster<'a> {
+ pub const fn get_fully_qualified_name() -> &'static str {
+ "MyGame.Example2.Monster"
+ }
+
#[inline]
pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
Monster {
@@ -152,54 +169,47 @@
}
}
+impl std::fmt::Debug for Monster<'_> {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ let mut ds = f.debug_struct("Monster");
+ ds.finish()
+ }
+}
} // pub mod Example2
#[allow(unused_imports, dead_code)]
pub mod example {
+ use crate::include_test1_generated::*;
+ use crate::include_test2_generated::*;
use std::mem;
use std::cmp::Ordering;
extern crate flatbuffers;
use self::flatbuffers::EndianScalar;
-/// Composite components of Monster color.
-#[allow(non_camel_case_types)]
-#[repr(u8)]
-#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
-pub enum Color {
- Red = 1,
- /// \brief color Green
- /// Green is bit_flag with value (1u << 1)
- Green = 2,
- /// \brief color Blue (1u << 3)
- Blue = 8,
-
+#[allow(non_upper_case_globals)]
+mod bitflags_color {
+ flatbuffers::bitflags::bitflags! {
+ /// Composite components of Monster color.
+ pub struct Color: u8 {
+ const Red = 1;
+ /// \brief color Green
+ /// Green is bit_flag with value (1u << 1)
+ const Green = 2;
+ /// \brief color Blue (1u << 3)
+ const Blue = 8;
+ }
+ }
}
-
-const ENUM_MIN_COLOR: u8 = 1;
-const ENUM_MAX_COLOR: u8 = 8;
+pub use self::bitflags_color::Color;
impl<'a> flatbuffers::Follow<'a> for Color {
type Inner = Self;
#[inline]
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
- flatbuffers::read_scalar_at::<Self>(buf, loc)
- }
-}
-
-impl flatbuffers::EndianScalar for Color {
- #[inline]
- fn to_little_endian(self) -> Self {
- let n = u8::to_le(self as u8);
- let p = &n as *const u8 as *const Color;
- unsafe { *p }
- }
- #[inline]
- fn from_little_endian(self) -> Self {
- let n = u8::from_le(self as u8);
- let p = &n as *const u8 as *const Color;
- unsafe { *p }
+ let bits = flatbuffers::read_scalar_at::<u8>(buf, loc);
+ unsafe { Self::from_bits_unchecked(bits) }
}
}
@@ -207,68 +217,157 @@
type Output = Color;
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
- flatbuffers::emplace_scalar::<Color>(dst, *self);
+ flatbuffers::emplace_scalar::<u8>(dst, self.bits());
}
}
-#[allow(non_camel_case_types)]
-const ENUM_VALUES_COLOR:[Color; 3] = [
- Color::Red,
- Color::Green,
- Color::Blue
-];
-
-#[allow(non_camel_case_types)]
-const ENUM_NAMES_COLOR:[&'static str; 8] = [
- "Red",
- "Green",
- "",
- "",
- "",
- "",
- "",
- "Blue"
-];
-
-pub fn enum_name_color(e: Color) -> &'static str {
- let index = e as u8 - Color::Red as u8;
- ENUM_NAMES_COLOR[index as usize]
+impl flatbuffers::EndianScalar for Color {
+ #[inline]
+ fn to_little_endian(self) -> Self {
+ let bits = u8::to_le(self.bits());
+ unsafe { Self::from_bits_unchecked(bits) }
+ }
+ #[inline]
+ fn from_little_endian(self) -> Self {
+ let bits = u8::from_le(self.bits());
+ unsafe { Self::from_bits_unchecked(bits) }
+ }
}
+#[deprecated(since = "1.13", note = "Use associated constants instead. This will no longer be generated in 2021.")]
+pub const ENUM_MIN_RACE: i8 = -1;
+#[deprecated(since = "1.13", note = "Use associated constants instead. This will no longer be generated in 2021.")]
+pub const ENUM_MAX_RACE: i8 = 2;
+#[deprecated(since = "1.13", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[allow(non_camel_case_types)]
-#[repr(u8)]
-#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
-pub enum Any {
- NONE = 0,
- Monster = 1,
- TestSimpleTableWithEnum = 2,
- MyGame_Example2_Monster = 3,
+pub const ENUM_VALUES_RACE: [Race; 4] = [
+ Race::None,
+ Race::Human,
+ Race::Dwarf,
+ Race::Elf,
+];
+#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
+#[repr(transparent)]
+pub struct Race(pub i8);
+#[allow(non_upper_case_globals)]
+impl Race {
+ pub const None: Self = Self(-1);
+ pub const Human: Self = Self(0);
+ pub const Dwarf: Self = Self(1);
+ pub const Elf: Self = Self(2);
+
+ pub const ENUM_MIN: i8 = -1;
+ pub const ENUM_MAX: i8 = 2;
+ pub const ENUM_VALUES: &'static [Self] = &[
+ Self::None,
+ Self::Human,
+ Self::Dwarf,
+ Self::Elf,
+ ];
+ /// Returns the variant's name or "" if unknown.
+ pub fn variant_name(self) -> Option<&'static str> {
+ match self {
+ Self::None => Some("None"),
+ Self::Human => Some("Human"),
+ Self::Dwarf => Some("Dwarf"),
+ Self::Elf => Some("Elf"),
+ _ => None,
+ }
+ }
+}
+impl std::fmt::Debug for Race {
+ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+ if let Some(name) = self.variant_name() {
+ f.write_str(name)
+ } else {
+ f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0))
+ }
+ }
+}
+impl<'a> flatbuffers::Follow<'a> for Race {
+ type Inner = Self;
+ #[inline]
+ fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
+ Self(flatbuffers::read_scalar_at::<i8>(buf, loc))
+ }
}
-const ENUM_MIN_ANY: u8 = 0;
-const ENUM_MAX_ANY: u8 = 3;
+impl flatbuffers::Push for Race {
+ type Output = Race;
+ #[inline]
+ fn push(&self, dst: &mut [u8], _rest: &[u8]) {
+ flatbuffers::emplace_scalar::<i8>(dst, self.0);
+ }
+}
+impl flatbuffers::EndianScalar for Race {
+ #[inline]
+ fn to_little_endian(self) -> Self {
+ Self(i8::to_le(self.0))
+ }
+ #[inline]
+ fn from_little_endian(self) -> Self {
+ Self(i8::from_le(self.0))
+ }
+}
+
+#[deprecated(since = "1.13", note = "Use associated constants instead. This will no longer be generated in 2021.")]
+pub const ENUM_MIN_ANY: u8 = 0;
+#[deprecated(since = "1.13", note = "Use associated constants instead. This will no longer be generated in 2021.")]
+pub const ENUM_MAX_ANY: u8 = 3;
+#[deprecated(since = "1.13", note = "Use associated constants instead. This will no longer be generated in 2021.")]
+#[allow(non_camel_case_types)]
+pub const ENUM_VALUES_ANY: [Any; 4] = [
+ Any::NONE,
+ Any::Monster,
+ Any::TestSimpleTableWithEnum,
+ Any::MyGame_Example2_Monster,
+];
+
+#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
+#[repr(transparent)]
+pub struct Any(pub u8);
+#[allow(non_upper_case_globals)]
+impl Any {
+ pub const NONE: Self = Self(0);
+ pub const Monster: Self = Self(1);
+ pub const TestSimpleTableWithEnum: Self = Self(2);
+ pub const MyGame_Example2_Monster: Self = Self(3);
+
+ pub const ENUM_MIN: u8 = 0;
+ pub const ENUM_MAX: u8 = 3;
+ pub const ENUM_VALUES: &'static [Self] = &[
+ Self::NONE,
+ Self::Monster,
+ Self::TestSimpleTableWithEnum,
+ Self::MyGame_Example2_Monster,
+ ];
+ /// Returns the variant's name or "" if unknown.
+ pub fn variant_name(self) -> Option<&'static str> {
+ match self {
+ Self::NONE => Some("NONE"),
+ Self::Monster => Some("Monster"),
+ Self::TestSimpleTableWithEnum => Some("TestSimpleTableWithEnum"),
+ Self::MyGame_Example2_Monster => Some("MyGame_Example2_Monster"),
+ _ => None,
+ }
+ }
+}
+impl std::fmt::Debug for Any {
+ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+ if let Some(name) = self.variant_name() {
+ f.write_str(name)
+ } else {
+ f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0))
+ }
+ }
+}
impl<'a> flatbuffers::Follow<'a> for Any {
type Inner = Self;
#[inline]
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
- flatbuffers::read_scalar_at::<Self>(buf, loc)
- }
-}
-
-impl flatbuffers::EndianScalar for Any {
- #[inline]
- fn to_little_endian(self) -> Self {
- let n = u8::to_le(self as u8);
- let p = &n as *const u8 as *const Any;
- unsafe { *p }
- }
- #[inline]
- fn from_little_endian(self) -> Self {
- let n = u8::from_le(self as u8);
- let p = &n as *const u8 as *const Any;
- unsafe { *p }
+ Self(flatbuffers::read_scalar_at::<u8>(buf, loc))
}
}
@@ -276,66 +375,78 @@
type Output = Any;
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
- flatbuffers::emplace_scalar::<Any>(dst, *self);
+ flatbuffers::emplace_scalar::<u8>(dst, self.0);
}
}
-#[allow(non_camel_case_types)]
-const ENUM_VALUES_ANY:[Any; 4] = [
- Any::NONE,
- Any::Monster,
- Any::TestSimpleTableWithEnum,
- Any::MyGame_Example2_Monster
-];
-
-#[allow(non_camel_case_types)]
-const ENUM_NAMES_ANY:[&'static str; 4] = [
- "NONE",
- "Monster",
- "TestSimpleTableWithEnum",
- "MyGame_Example2_Monster"
-];
-
-pub fn enum_name_any(e: Any) -> &'static str {
- let index = e as u8;
- ENUM_NAMES_ANY[index as usize]
+impl flatbuffers::EndianScalar for Any {
+ #[inline]
+ fn to_little_endian(self) -> Self {
+ Self(u8::to_le(self.0))
+ }
+ #[inline]
+ fn from_little_endian(self) -> Self {
+ Self(u8::from_le(self.0))
+ }
}
pub struct AnyUnionTableOffset {}
+#[deprecated(since = "1.13", note = "Use associated constants instead. This will no longer be generated in 2021.")]
+pub const ENUM_MIN_ANY_UNIQUE_ALIASES: u8 = 0;
+#[deprecated(since = "1.13", note = "Use associated constants instead. This will no longer be generated in 2021.")]
+pub const ENUM_MAX_ANY_UNIQUE_ALIASES: u8 = 3;
+#[deprecated(since = "1.13", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[allow(non_camel_case_types)]
-#[repr(u8)]
-#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
-pub enum AnyUniqueAliases {
- NONE = 0,
- M = 1,
- TS = 2,
- M2 = 3,
+pub const ENUM_VALUES_ANY_UNIQUE_ALIASES: [AnyUniqueAliases; 4] = [
+ AnyUniqueAliases::NONE,
+ AnyUniqueAliases::M,
+ AnyUniqueAliases::TS,
+ AnyUniqueAliases::M2,
+];
+#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
+#[repr(transparent)]
+pub struct AnyUniqueAliases(pub u8);
+#[allow(non_upper_case_globals)]
+impl AnyUniqueAliases {
+ pub const NONE: Self = Self(0);
+ pub const M: Self = Self(1);
+ pub const TS: Self = Self(2);
+ pub const M2: Self = Self(3);
+
+ pub const ENUM_MIN: u8 = 0;
+ pub const ENUM_MAX: u8 = 3;
+ pub const ENUM_VALUES: &'static [Self] = &[
+ Self::NONE,
+ Self::M,
+ Self::TS,
+ Self::M2,
+ ];
+ /// Returns the variant's name or "" if unknown.
+ pub fn variant_name(self) -> Option<&'static str> {
+ match self {
+ Self::NONE => Some("NONE"),
+ Self::M => Some("M"),
+ Self::TS => Some("TS"),
+ Self::M2 => Some("M2"),
+ _ => None,
+ }
+ }
}
-
-const ENUM_MIN_ANY_UNIQUE_ALIASES: u8 = 0;
-const ENUM_MAX_ANY_UNIQUE_ALIASES: u8 = 3;
-
+impl std::fmt::Debug for AnyUniqueAliases {
+ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+ if let Some(name) = self.variant_name() {
+ f.write_str(name)
+ } else {
+ f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0))
+ }
+ }
+}
impl<'a> flatbuffers::Follow<'a> for AnyUniqueAliases {
type Inner = Self;
#[inline]
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
- flatbuffers::read_scalar_at::<Self>(buf, loc)
- }
-}
-
-impl flatbuffers::EndianScalar for AnyUniqueAliases {
- #[inline]
- fn to_little_endian(self) -> Self {
- let n = u8::to_le(self as u8);
- let p = &n as *const u8 as *const AnyUniqueAliases;
- unsafe { *p }
- }
- #[inline]
- fn from_little_endian(self) -> Self {
- let n = u8::from_le(self as u8);
- let p = &n as *const u8 as *const AnyUniqueAliases;
- unsafe { *p }
+ Self(flatbuffers::read_scalar_at::<u8>(buf, loc))
}
}
@@ -343,66 +454,78 @@
type Output = AnyUniqueAliases;
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
- flatbuffers::emplace_scalar::<AnyUniqueAliases>(dst, *self);
+ flatbuffers::emplace_scalar::<u8>(dst, self.0);
}
}
-#[allow(non_camel_case_types)]
-const ENUM_VALUES_ANY_UNIQUE_ALIASES:[AnyUniqueAliases; 4] = [
- AnyUniqueAliases::NONE,
- AnyUniqueAliases::M,
- AnyUniqueAliases::TS,
- AnyUniqueAliases::M2
-];
-
-#[allow(non_camel_case_types)]
-const ENUM_NAMES_ANY_UNIQUE_ALIASES:[&'static str; 4] = [
- "NONE",
- "M",
- "TS",
- "M2"
-];
-
-pub fn enum_name_any_unique_aliases(e: AnyUniqueAliases) -> &'static str {
- let index = e as u8;
- ENUM_NAMES_ANY_UNIQUE_ALIASES[index as usize]
+impl flatbuffers::EndianScalar for AnyUniqueAliases {
+ #[inline]
+ fn to_little_endian(self) -> Self {
+ Self(u8::to_le(self.0))
+ }
+ #[inline]
+ fn from_little_endian(self) -> Self {
+ Self(u8::from_le(self.0))
+ }
}
pub struct AnyUniqueAliasesUnionTableOffset {}
+#[deprecated(since = "1.13", note = "Use associated constants instead. This will no longer be generated in 2021.")]
+pub const ENUM_MIN_ANY_AMBIGUOUS_ALIASES: u8 = 0;
+#[deprecated(since = "1.13", note = "Use associated constants instead. This will no longer be generated in 2021.")]
+pub const ENUM_MAX_ANY_AMBIGUOUS_ALIASES: u8 = 3;
+#[deprecated(since = "1.13", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[allow(non_camel_case_types)]
-#[repr(u8)]
-#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
-pub enum AnyAmbiguousAliases {
- NONE = 0,
- M1 = 1,
- M2 = 2,
- M3 = 3,
+pub const ENUM_VALUES_ANY_AMBIGUOUS_ALIASES: [AnyAmbiguousAliases; 4] = [
+ AnyAmbiguousAliases::NONE,
+ AnyAmbiguousAliases::M1,
+ AnyAmbiguousAliases::M2,
+ AnyAmbiguousAliases::M3,
+];
+#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
+#[repr(transparent)]
+pub struct AnyAmbiguousAliases(pub u8);
+#[allow(non_upper_case_globals)]
+impl AnyAmbiguousAliases {
+ pub const NONE: Self = Self(0);
+ pub const M1: Self = Self(1);
+ pub const M2: Self = Self(2);
+ pub const M3: Self = Self(3);
+
+ pub const ENUM_MIN: u8 = 0;
+ pub const ENUM_MAX: u8 = 3;
+ pub const ENUM_VALUES: &'static [Self] = &[
+ Self::NONE,
+ Self::M1,
+ Self::M2,
+ Self::M3,
+ ];
+ /// Returns the variant's name or "" if unknown.
+ pub fn variant_name(self) -> Option<&'static str> {
+ match self {
+ Self::NONE => Some("NONE"),
+ Self::M1 => Some("M1"),
+ Self::M2 => Some("M2"),
+ Self::M3 => Some("M3"),
+ _ => None,
+ }
+ }
}
-
-const ENUM_MIN_ANY_AMBIGUOUS_ALIASES: u8 = 0;
-const ENUM_MAX_ANY_AMBIGUOUS_ALIASES: u8 = 3;
-
+impl std::fmt::Debug for AnyAmbiguousAliases {
+ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+ if let Some(name) = self.variant_name() {
+ f.write_str(name)
+ } else {
+ f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0))
+ }
+ }
+}
impl<'a> flatbuffers::Follow<'a> for AnyAmbiguousAliases {
type Inner = Self;
#[inline]
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
- flatbuffers::read_scalar_at::<Self>(buf, loc)
- }
-}
-
-impl flatbuffers::EndianScalar for AnyAmbiguousAliases {
- #[inline]
- fn to_little_endian(self) -> Self {
- let n = u8::to_le(self as u8);
- let p = &n as *const u8 as *const AnyAmbiguousAliases;
- unsafe { *p }
- }
- #[inline]
- fn from_little_endian(self) -> Self {
- let n = u8::from_le(self as u8);
- let p = &n as *const u8 as *const AnyAmbiguousAliases;
- unsafe { *p }
+ Self(flatbuffers::read_scalar_at::<u8>(buf, loc))
}
}
@@ -410,40 +533,39 @@
type Output = AnyAmbiguousAliases;
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
- flatbuffers::emplace_scalar::<AnyAmbiguousAliases>(dst, *self);
+ flatbuffers::emplace_scalar::<u8>(dst, self.0);
}
}
-#[allow(non_camel_case_types)]
-const ENUM_VALUES_ANY_AMBIGUOUS_ALIASES:[AnyAmbiguousAliases; 4] = [
- AnyAmbiguousAliases::NONE,
- AnyAmbiguousAliases::M1,
- AnyAmbiguousAliases::M2,
- AnyAmbiguousAliases::M3
-];
-
-#[allow(non_camel_case_types)]
-const ENUM_NAMES_ANY_AMBIGUOUS_ALIASES:[&'static str; 4] = [
- "NONE",
- "M1",
- "M2",
- "M3"
-];
-
-pub fn enum_name_any_ambiguous_aliases(e: AnyAmbiguousAliases) -> &'static str {
- let index = e as u8;
- ENUM_NAMES_ANY_AMBIGUOUS_ALIASES[index as usize]
+impl flatbuffers::EndianScalar for AnyAmbiguousAliases {
+ #[inline]
+ fn to_little_endian(self) -> Self {
+ Self(u8::to_le(self.0))
+ }
+ #[inline]
+ fn from_little_endian(self) -> Self {
+ Self(u8::from_le(self.0))
+ }
}
pub struct AnyAmbiguousAliasesUnionTableOffset {}
// struct Test, aligned to 2
#[repr(C, align(2))]
-#[derive(Clone, Copy, Debug, PartialEq)]
+#[derive(Clone, Copy, PartialEq)]
pub struct Test {
a_: i16,
b_: i8,
padding0__: u8,
} // pub struct Test
+impl std::fmt::Debug for Test {
+ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+ f.debug_struct("Test")
+ .field("a", &self.a())
+ .field("b", &self.b())
+ .finish()
+ }
+}
+
impl flatbuffers::SafeSliceAccess for Test {}
impl<'a> flatbuffers::Follow<'a> for Test {
type Inner = &'a Test;
@@ -483,7 +605,7 @@
impl Test {
- pub fn new<'a>(_a: i16, _b: i8) -> Self {
+ pub fn new(_a: i16, _b: i8) -> Self {
Test {
a_: _a.to_little_endian(),
b_: _b.to_little_endian(),
@@ -491,17 +613,21 @@
padding0__: 0,
}
}
- pub fn a<'a>(&'a self) -> i16 {
+ pub const fn get_fully_qualified_name() -> &'static str {
+ "MyGame.Example.Test"
+ }
+
+ pub fn a(&self) -> i16 {
self.a_.from_little_endian()
}
- pub fn b<'a>(&'a self) -> i8 {
+ pub fn b(&self) -> i8 {
self.b_.from_little_endian()
}
}
// struct Vec3, aligned to 8
#[repr(C, align(8))]
-#[derive(Clone, Copy, Debug, PartialEq)]
+#[derive(Clone, Copy, PartialEq)]
pub struct Vec3 {
x_: f32,
y_: f32,
@@ -513,6 +639,19 @@
test3_: Test,
padding2__: u16,
} // pub struct Vec3
+impl std::fmt::Debug for Vec3 {
+ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+ f.debug_struct("Vec3")
+ .field("x", &self.x())
+ .field("y", &self.y())
+ .field("z", &self.z())
+ .field("test1", &self.test1())
+ .field("test2", &self.test2())
+ .field("test3", &self.test3())
+ .finish()
+ }
+}
+
impl flatbuffers::SafeSliceAccess for Vec3 {}
impl<'a> flatbuffers::Follow<'a> for Vec3 {
type Inner = &'a Vec3;
@@ -552,7 +691,7 @@
impl Vec3 {
- pub fn new<'a>(_x: f32, _y: f32, _z: f32, _test1: f64, _test2: Color, _test3: &'a Test) -> Self {
+ pub fn new(_x: f32, _y: f32, _z: f32, _test1: f64, _test2: Color, _test3: &Test) -> Self {
Vec3 {
x_: _x.to_little_endian(),
y_: _y.to_little_endian(),
@@ -566,33 +705,46 @@
padding2__: 0,
}
}
- pub fn x<'a>(&'a self) -> f32 {
+ pub const fn get_fully_qualified_name() -> &'static str {
+ "MyGame.Example.Vec3"
+ }
+
+ pub fn x(&self) -> f32 {
self.x_.from_little_endian()
}
- pub fn y<'a>(&'a self) -> f32 {
+ pub fn y(&self) -> f32 {
self.y_.from_little_endian()
}
- pub fn z<'a>(&'a self) -> f32 {
+ pub fn z(&self) -> f32 {
self.z_.from_little_endian()
}
- pub fn test1<'a>(&'a self) -> f64 {
+ pub fn test1(&self) -> f64 {
self.test1_.from_little_endian()
}
- pub fn test2<'a>(&'a self) -> Color {
+ pub fn test2(&self) -> Color {
self.test2_.from_little_endian()
}
- pub fn test3<'a>(&'a self) -> &'a Test {
+ pub fn test3(&self) -> &Test {
&self.test3_
}
}
// struct Ability, aligned to 4
#[repr(C, align(4))]
-#[derive(Clone, Copy, Debug, PartialEq)]
+#[derive(Clone, Copy, PartialEq)]
pub struct Ability {
id_: u32,
distance_: u32,
} // pub struct Ability
+impl std::fmt::Debug for Ability {
+ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+ f.debug_struct("Ability")
+ .field("id", &self.id())
+ .field("distance", &self.distance())
+ .finish()
+ }
+}
+
impl flatbuffers::SafeSliceAccess for Ability {}
impl<'a> flatbuffers::Follow<'a> for Ability {
type Inner = &'a Ability;
@@ -632,14 +784,18 @@
impl Ability {
- pub fn new<'a>(_id: u32, _distance: u32) -> Self {
+ pub fn new(_id: u32, _distance: u32) -> Self {
Ability {
id_: _id.to_little_endian(),
distance_: _distance.to_little_endian(),
}
}
- pub fn id<'a>(&'a self) -> u32 {
+ pub const fn get_fully_qualified_name() -> &'static str {
+ "MyGame.Example.Ability"
+ }
+
+ pub fn id(&self) -> u32 {
self.id_.from_little_endian()
}
#[inline]
@@ -652,13 +808,13 @@
let key = self.id();
key.cmp(&val)
}
- pub fn distance<'a>(&'a self) -> u32 {
+ pub fn distance(&self) -> u32 {
self.distance_.from_little_endian()
}
}
pub enum TestSimpleTableWithEnumOffset {}
-#[derive(Copy, Clone, Debug, PartialEq)]
+#[derive(Copy, Clone, PartialEq)]
pub struct TestSimpleTableWithEnum<'a> {
pub _tab: flatbuffers::Table<'a>,
@@ -668,13 +824,15 @@
type Inner = TestSimpleTableWithEnum<'a>;
#[inline]
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
- Self {
- _tab: flatbuffers::Table { buf: buf, loc: loc },
- }
+ Self { _tab: flatbuffers::Table { buf, loc } }
}
}
impl<'a> TestSimpleTableWithEnum<'a> {
+ pub const fn get_fully_qualified_name() -> &'static str {
+ "MyGame.Example.TestSimpleTableWithEnum"
+ }
+
#[inline]
pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
TestSimpleTableWithEnum {
@@ -733,8 +891,15 @@
}
}
+impl std::fmt::Debug for TestSimpleTableWithEnum<'_> {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ let mut ds = f.debug_struct("TestSimpleTableWithEnum");
+ ds.field("color", &self.color());
+ ds.finish()
+ }
+}
pub enum StatOffset {}
-#[derive(Copy, Clone, Debug, PartialEq)]
+#[derive(Copy, Clone, PartialEq)]
pub struct Stat<'a> {
pub _tab: flatbuffers::Table<'a>,
@@ -744,13 +909,15 @@
type Inner = Stat<'a>;
#[inline]
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
- Self {
- _tab: flatbuffers::Table { buf: buf, loc: loc },
- }
+ Self { _tab: flatbuffers::Table { buf, loc } }
}
}
impl<'a> Stat<'a> {
+ pub const fn get_fully_qualified_name() -> &'static str {
+ "MyGame.Example.Stat"
+ }
+
#[inline]
pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
Stat {
@@ -787,7 +954,7 @@
}
pub struct StatArgs<'a> {
- pub id: Option<flatbuffers::WIPOffset<&'a str>>,
+ pub id: Option<flatbuffers::WIPOffset<&'a str>>,
pub val: i64,
pub count: u16,
}
@@ -833,8 +1000,17 @@
}
}
+impl std::fmt::Debug for Stat<'_> {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ let mut ds = f.debug_struct("Stat");
+ ds.field("id", &self.id());
+ ds.field("val", &self.val());
+ ds.field("count", &self.count());
+ ds.finish()
+ }
+}
pub enum ReferrableOffset {}
-#[derive(Copy, Clone, Debug, PartialEq)]
+#[derive(Copy, Clone, PartialEq)]
pub struct Referrable<'a> {
pub _tab: flatbuffers::Table<'a>,
@@ -844,13 +1020,15 @@
type Inner = Referrable<'a>;
#[inline]
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
- Self {
- _tab: flatbuffers::Table { buf: buf, loc: loc },
- }
+ Self { _tab: flatbuffers::Table { buf, loc } }
}
}
impl<'a> Referrable<'a> {
+ pub const fn get_fully_qualified_name() -> &'static str {
+ "MyGame.Example.Referrable"
+ }
+
#[inline]
pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
Referrable {
@@ -919,10 +1097,17 @@
}
}
+impl std::fmt::Debug for Referrable<'_> {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ let mut ds = f.debug_struct("Referrable");
+ ds.field("id", &self.id());
+ ds.finish()
+ }
+}
pub enum MonsterOffset {}
-#[derive(Copy, Clone, Debug, PartialEq)]
+#[derive(Copy, Clone, PartialEq)]
-/// an example documentation comment: monster object
+/// an example documentation comment: "monster object"
pub struct Monster<'a> {
pub _tab: flatbuffers::Table<'a>,
}
@@ -931,13 +1116,15 @@
type Inner = Monster<'a>;
#[inline]
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
- Self {
- _tab: flatbuffers::Table { buf: buf, loc: loc },
- }
+ Self { _tab: flatbuffers::Table { buf, loc } }
}
}
impl<'a> Monster<'a> {
+ pub const fn get_fully_qualified_name() -> &'static str {
+ "MyGame.Example.Monster"
+ }
+
#[inline]
pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
Monster {
@@ -956,6 +1143,7 @@
builder.add_testhashs64_fnv1a(args.testhashs64_fnv1a);
builder.add_testhashu64_fnv1(args.testhashu64_fnv1);
builder.add_testhashs64_fnv1(args.testhashs64_fnv1);
+ if let Some(x) = args.testrequirednestedflatbuffer { builder.add_testrequirednestedflatbuffer(x); }
if let Some(x) = args.vector_of_enums { builder.add_vector_of_enums(x); }
if let Some(x) = args.any_ambiguous { builder.add_any_ambiguous(x); }
if let Some(x) = args.any_unique { builder.add_any_unique(x); }
@@ -991,6 +1179,7 @@
if let Some(x) = args.pos { builder.add_pos(x); }
builder.add_hp(args.hp);
builder.add_mana(args.mana);
+ builder.add_signed_enum(args.signed_enum);
builder.add_any_ambiguous_type(args.any_ambiguous_type);
builder.add_any_unique_type(args.any_unique_type);
builder.add_testbool(args.testbool);
@@ -1046,6 +1235,8 @@
pub const VT_ANY_AMBIGUOUS_TYPE: flatbuffers::VOffsetT = 94;
pub const VT_ANY_AMBIGUOUS: flatbuffers::VOffsetT = 96;
pub const VT_VECTOR_OF_ENUMS: flatbuffers::VOffsetT = 98;
+ pub const VT_SIGNED_ENUM: flatbuffers::VOffsetT = 100;
+ pub const VT_TESTREQUIREDNESTEDFLATBUFFER: flatbuffers::VOffsetT = 102;
#[inline]
pub fn pos(&self) -> Option<&'a Vec3> {
@@ -1111,14 +1302,11 @@
pub fn testnestedflatbuffer(&self) -> Option<&'a [u8]> {
self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u8>>>(Monster::VT_TESTNESTEDFLATBUFFER, None).map(|v| v.safe_slice())
}
- pub fn testnestedflatbuffer_nested_flatbuffer(&'a self) -> Option<Monster<'a>> {
- match self.testnestedflatbuffer() {
- None => { None }
- Some(data) => {
- use self::flatbuffers::Follow;
- Some(<flatbuffers::ForwardsUOffset<Monster<'a>>>::follow(data, 0))
- },
- }
+ pub fn testnestedflatbuffer_nested_flatbuffer(&'a self) -> Option<Monster<'a>> {
+ self.testnestedflatbuffer().map(|data| {
+ use flatbuffers::Follow;
+ <flatbuffers::ForwardsUOffset<Monster<'a>>>::follow(data, 0)
+ })
}
#[inline]
pub fn testempty(&self) -> Option<Stat<'a>> {
@@ -1257,10 +1445,24 @@
self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, Color>>>(Monster::VT_VECTOR_OF_ENUMS, None)
}
#[inline]
+ pub fn signed_enum(&self) -> Race {
+ self._tab.get::<Race>(Monster::VT_SIGNED_ENUM, Some(Race::None)).unwrap()
+ }
+ #[inline]
+ pub fn testrequirednestedflatbuffer(&self) -> Option<&'a [u8]> {
+ self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u8>>>(Monster::VT_TESTREQUIREDNESTEDFLATBUFFER, None).map(|v| v.safe_slice())
+ }
+ pub fn testrequirednestedflatbuffer_nested_flatbuffer(&'a self) -> Option<Monster<'a>> {
+ self.testrequirednestedflatbuffer().map(|data| {
+ use flatbuffers::Follow;
+ <flatbuffers::ForwardsUOffset<Monster<'a>>>::follow(data, 0)
+ })
+ }
+ #[inline]
#[allow(non_snake_case)]
pub fn test_as_monster(&self) -> Option<Monster<'a>> {
if self.test_type() == Any::Monster {
- self.test().map(|u| Monster::init_from_table(u))
+ self.test().map(Monster::init_from_table)
} else {
None
}
@@ -1270,7 +1472,7 @@
#[allow(non_snake_case)]
pub fn test_as_test_simple_table_with_enum(&self) -> Option<TestSimpleTableWithEnum<'a>> {
if self.test_type() == Any::TestSimpleTableWithEnum {
- self.test().map(|u| TestSimpleTableWithEnum::init_from_table(u))
+ self.test().map(TestSimpleTableWithEnum::init_from_table)
} else {
None
}
@@ -1280,7 +1482,7 @@
#[allow(non_snake_case)]
pub fn test_as_my_game_example_2_monster(&self) -> Option<super::example_2::Monster<'a>> {
if self.test_type() == Any::MyGame_Example2_Monster {
- self.test().map(|u| super::example_2::Monster::init_from_table(u))
+ self.test().map(super::example_2::Monster::init_from_table)
} else {
None
}
@@ -1290,7 +1492,7 @@
#[allow(non_snake_case)]
pub fn any_unique_as_m(&self) -> Option<Monster<'a>> {
if self.any_unique_type() == AnyUniqueAliases::M {
- self.any_unique().map(|u| Monster::init_from_table(u))
+ self.any_unique().map(Monster::init_from_table)
} else {
None
}
@@ -1300,7 +1502,7 @@
#[allow(non_snake_case)]
pub fn any_unique_as_ts(&self) -> Option<TestSimpleTableWithEnum<'a>> {
if self.any_unique_type() == AnyUniqueAliases::TS {
- self.any_unique().map(|u| TestSimpleTableWithEnum::init_from_table(u))
+ self.any_unique().map(TestSimpleTableWithEnum::init_from_table)
} else {
None
}
@@ -1310,7 +1512,7 @@
#[allow(non_snake_case)]
pub fn any_unique_as_m2(&self) -> Option<super::example_2::Monster<'a>> {
if self.any_unique_type() == AnyUniqueAliases::M2 {
- self.any_unique().map(|u| super::example_2::Monster::init_from_table(u))
+ self.any_unique().map(super::example_2::Monster::init_from_table)
} else {
None
}
@@ -1320,7 +1522,7 @@
#[allow(non_snake_case)]
pub fn any_ambiguous_as_m1(&self) -> Option<Monster<'a>> {
if self.any_ambiguous_type() == AnyAmbiguousAliases::M1 {
- self.any_ambiguous().map(|u| Monster::init_from_table(u))
+ self.any_ambiguous().map(Monster::init_from_table)
} else {
None
}
@@ -1330,7 +1532,7 @@
#[allow(non_snake_case)]
pub fn any_ambiguous_as_m2(&self) -> Option<Monster<'a>> {
if self.any_ambiguous_type() == AnyAmbiguousAliases::M2 {
- self.any_ambiguous().map(|u| Monster::init_from_table(u))
+ self.any_ambiguous().map(Monster::init_from_table)
} else {
None
}
@@ -1340,7 +1542,7 @@
#[allow(non_snake_case)]
pub fn any_ambiguous_as_m3(&self) -> Option<Monster<'a>> {
if self.any_ambiguous_type() == AnyAmbiguousAliases::M3 {
- self.any_ambiguous().map(|u| Monster::init_from_table(u))
+ self.any_ambiguous().map(Monster::init_from_table)
} else {
None
}
@@ -1349,20 +1551,20 @@
}
pub struct MonsterArgs<'a> {
- pub pos: Option<&'a Vec3>,
+ pub pos: Option<&'a Vec3>,
pub mana: i16,
pub hp: i16,
- pub name: Option<flatbuffers::WIPOffset<&'a str>>,
- pub inventory: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , u8>>>,
+ pub name: Option<flatbuffers::WIPOffset<&'a str>>,
+ pub inventory: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u8>>>,
pub color: Color,
pub test_type: Any,
pub test: Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>>,
- pub test4: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , Test>>>,
- pub testarrayofstring: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , flatbuffers::ForwardsUOffset<&'a str>>>>,
- pub testarrayoftables: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , flatbuffers::ForwardsUOffset<Monster<'a >>>>>,
- pub enemy: Option<flatbuffers::WIPOffset<Monster<'a >>>,
- pub testnestedflatbuffer: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , u8>>>,
- pub testempty: Option<flatbuffers::WIPOffset<Stat<'a >>>,
+ pub test4: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, Test>>>,
+ pub testarrayofstring: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<&'a str>>>>,
+ pub testarrayoftables: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Monster<'a>>>>>,
+ pub enemy: Option<flatbuffers::WIPOffset<Monster<'a>>>,
+ pub testnestedflatbuffer: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u8>>>,
+ pub testempty: Option<flatbuffers::WIPOffset<Stat<'a>>>,
pub testbool: bool,
pub testhashs32_fnv1: i32,
pub testhashu32_fnv1: u32,
@@ -1372,30 +1574,32 @@
pub testhashu32_fnv1a: u32,
pub testhashs64_fnv1a: i64,
pub testhashu64_fnv1a: u64,
- pub testarrayofbools: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , bool>>>,
+ pub testarrayofbools: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, bool>>>,
pub testf: f32,
pub testf2: f32,
pub testf3: f32,
- pub testarrayofstring2: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , flatbuffers::ForwardsUOffset<&'a str>>>>,
- pub testarrayofsortedstruct: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , Ability>>>,
- pub flex: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , u8>>>,
- pub test5: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , Test>>>,
- pub vector_of_longs: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , i64>>>,
- pub vector_of_doubles: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , f64>>>,
- pub parent_namespace_test: Option<flatbuffers::WIPOffset<super::InParentNamespace<'a >>>,
- pub vector_of_referrables: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , flatbuffers::ForwardsUOffset<Referrable<'a >>>>>,
+ pub testarrayofstring2: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<&'a str>>>>,
+ pub testarrayofsortedstruct: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, Ability>>>,
+ pub flex: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u8>>>,
+ pub test5: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, Test>>>,
+ pub vector_of_longs: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, i64>>>,
+ pub vector_of_doubles: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, f64>>>,
+ pub parent_namespace_test: Option<flatbuffers::WIPOffset<super::InParentNamespace<'a>>>,
+ pub vector_of_referrables: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Referrable<'a>>>>>,
pub single_weak_reference: u64,
- pub vector_of_weak_references: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , u64>>>,
- pub vector_of_strong_referrables: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , flatbuffers::ForwardsUOffset<Referrable<'a >>>>>,
+ pub vector_of_weak_references: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u64>>>,
+ pub vector_of_strong_referrables: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Referrable<'a>>>>>,
pub co_owning_reference: u64,
- pub vector_of_co_owning_references: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , u64>>>,
+ pub vector_of_co_owning_references: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u64>>>,
pub non_owning_reference: u64,
- pub vector_of_non_owning_references: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , u64>>>,
+ pub vector_of_non_owning_references: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u64>>>,
pub any_unique_type: AnyUniqueAliases,
pub any_unique: Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>>,
pub any_ambiguous_type: AnyAmbiguousAliases,
pub any_ambiguous: Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>>,
- pub vector_of_enums: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , Color>>>,
+ pub vector_of_enums: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, Color>>>,
+ pub signed_enum: Race,
+ pub testrequirednestedflatbuffer: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u8>>>,
}
impl<'a> Default for MonsterArgs<'a> {
#[inline]
@@ -1448,6 +1652,8 @@
any_ambiguous_type: AnyAmbiguousAliases::NONE,
any_ambiguous: None,
vector_of_enums: None,
+ signed_enum: Race::None,
+ testrequirednestedflatbuffer: None,
}
}
}
@@ -1457,7 +1663,7 @@
}
impl<'a: 'b, 'b> MonsterBuilder<'a, 'b> {
#[inline]
- pub fn add_pos(&mut self, pos: &'b Vec3) {
+ pub fn add_pos(&mut self, pos: &Vec3) {
self.fbb_.push_slot_always::<&Vec3>(Monster::VT_POS, pos);
}
#[inline]
@@ -1645,6 +1851,14 @@
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_VECTOR_OF_ENUMS, vector_of_enums);
}
#[inline]
+ pub fn add_signed_enum(&mut self, signed_enum: Race) {
+ self.fbb_.push_slot::<Race>(Monster::VT_SIGNED_ENUM, signed_enum, Race::None);
+ }
+ #[inline]
+ pub fn add_testrequirednestedflatbuffer(&mut self, testrequirednestedflatbuffer: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u8>>) {
+ self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Monster::VT_TESTREQUIREDNESTEDFLATBUFFER, testrequirednestedflatbuffer);
+ }
+ #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> MonsterBuilder<'a, 'b> {
let start = _fbb.start_table();
MonsterBuilder {
@@ -1660,8 +1874,141 @@
}
}
+impl std::fmt::Debug for Monster<'_> {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ let mut ds = f.debug_struct("Monster");
+ ds.field("pos", &self.pos());
+ ds.field("mana", &self.mana());
+ ds.field("hp", &self.hp());
+ ds.field("name", &self.name());
+ ds.field("inventory", &self.inventory());
+ ds.field("color", &self.color());
+ ds.field("test_type", &self.test_type());
+ match self.test_type() {
+ Any::Monster => {
+ if let Some(x) = self.test_as_monster() {
+ ds.field("test", &x)
+ } else {
+ ds.field("test", &"InvalidFlatbuffer: Union discriminant does not match value.")
+ }
+ },
+ Any::TestSimpleTableWithEnum => {
+ if let Some(x) = self.test_as_test_simple_table_with_enum() {
+ ds.field("test", &x)
+ } else {
+ ds.field("test", &"InvalidFlatbuffer: Union discriminant does not match value.")
+ }
+ },
+ Any::MyGame_Example2_Monster => {
+ if let Some(x) = self.test_as_my_game_example_2_monster() {
+ ds.field("test", &x)
+ } else {
+ ds.field("test", &"InvalidFlatbuffer: Union discriminant does not match value.")
+ }
+ },
+ _ => {
+ let x: Option<()> = None;
+ ds.field("test", &x)
+ },
+ };
+ ds.field("test4", &self.test4());
+ ds.field("testarrayofstring", &self.testarrayofstring());
+ ds.field("testarrayoftables", &self.testarrayoftables());
+ ds.field("enemy", &self.enemy());
+ ds.field("testnestedflatbuffer", &self.testnestedflatbuffer());
+ ds.field("testempty", &self.testempty());
+ ds.field("testbool", &self.testbool());
+ ds.field("testhashs32_fnv1", &self.testhashs32_fnv1());
+ ds.field("testhashu32_fnv1", &self.testhashu32_fnv1());
+ ds.field("testhashs64_fnv1", &self.testhashs64_fnv1());
+ ds.field("testhashu64_fnv1", &self.testhashu64_fnv1());
+ ds.field("testhashs32_fnv1a", &self.testhashs32_fnv1a());
+ ds.field("testhashu32_fnv1a", &self.testhashu32_fnv1a());
+ ds.field("testhashs64_fnv1a", &self.testhashs64_fnv1a());
+ ds.field("testhashu64_fnv1a", &self.testhashu64_fnv1a());
+ ds.field("testarrayofbools", &self.testarrayofbools());
+ ds.field("testf", &self.testf());
+ ds.field("testf2", &self.testf2());
+ ds.field("testf3", &self.testf3());
+ ds.field("testarrayofstring2", &self.testarrayofstring2());
+ ds.field("testarrayofsortedstruct", &self.testarrayofsortedstruct());
+ ds.field("flex", &self.flex());
+ ds.field("test5", &self.test5());
+ ds.field("vector_of_longs", &self.vector_of_longs());
+ ds.field("vector_of_doubles", &self.vector_of_doubles());
+ ds.field("parent_namespace_test", &self.parent_namespace_test());
+ ds.field("vector_of_referrables", &self.vector_of_referrables());
+ ds.field("single_weak_reference", &self.single_weak_reference());
+ ds.field("vector_of_weak_references", &self.vector_of_weak_references());
+ ds.field("vector_of_strong_referrables", &self.vector_of_strong_referrables());
+ ds.field("co_owning_reference", &self.co_owning_reference());
+ ds.field("vector_of_co_owning_references", &self.vector_of_co_owning_references());
+ ds.field("non_owning_reference", &self.non_owning_reference());
+ ds.field("vector_of_non_owning_references", &self.vector_of_non_owning_references());
+ ds.field("any_unique_type", &self.any_unique_type());
+ match self.any_unique_type() {
+ AnyUniqueAliases::M => {
+ if let Some(x) = self.any_unique_as_m() {
+ ds.field("any_unique", &x)
+ } else {
+ ds.field("any_unique", &"InvalidFlatbuffer: Union discriminant does not match value.")
+ }
+ },
+ AnyUniqueAliases::TS => {
+ if let Some(x) = self.any_unique_as_ts() {
+ ds.field("any_unique", &x)
+ } else {
+ ds.field("any_unique", &"InvalidFlatbuffer: Union discriminant does not match value.")
+ }
+ },
+ AnyUniqueAliases::M2 => {
+ if let Some(x) = self.any_unique_as_m2() {
+ ds.field("any_unique", &x)
+ } else {
+ ds.field("any_unique", &"InvalidFlatbuffer: Union discriminant does not match value.")
+ }
+ },
+ _ => {
+ let x: Option<()> = None;
+ ds.field("any_unique", &x)
+ },
+ };
+ ds.field("any_ambiguous_type", &self.any_ambiguous_type());
+ match self.any_ambiguous_type() {
+ AnyAmbiguousAliases::M1 => {
+ if let Some(x) = self.any_ambiguous_as_m1() {
+ ds.field("any_ambiguous", &x)
+ } else {
+ ds.field("any_ambiguous", &"InvalidFlatbuffer: Union discriminant does not match value.")
+ }
+ },
+ AnyAmbiguousAliases::M2 => {
+ if let Some(x) = self.any_ambiguous_as_m2() {
+ ds.field("any_ambiguous", &x)
+ } else {
+ ds.field("any_ambiguous", &"InvalidFlatbuffer: Union discriminant does not match value.")
+ }
+ },
+ AnyAmbiguousAliases::M3 => {
+ if let Some(x) = self.any_ambiguous_as_m3() {
+ ds.field("any_ambiguous", &x)
+ } else {
+ ds.field("any_ambiguous", &"InvalidFlatbuffer: Union discriminant does not match value.")
+ }
+ },
+ _ => {
+ let x: Option<()> = None;
+ ds.field("any_ambiguous", &x)
+ },
+ };
+ ds.field("vector_of_enums", &self.vector_of_enums());
+ ds.field("signed_enum", &self.signed_enum());
+ ds.field("testrequirednestedflatbuffer", &self.testrequirednestedflatbuffer());
+ ds.finish()
+ }
+}
pub enum TypeAliasesOffset {}
-#[derive(Copy, Clone, Debug, PartialEq)]
+#[derive(Copy, Clone, PartialEq)]
pub struct TypeAliases<'a> {
pub _tab: flatbuffers::Table<'a>,
@@ -1671,13 +2018,15 @@
type Inner = TypeAliases<'a>;
#[inline]
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
- Self {
- _tab: flatbuffers::Table { buf: buf, loc: loc },
- }
+ Self { _tab: flatbuffers::Table { buf, loc } }
}
}
impl<'a> TypeAliases<'a> {
+ pub const fn get_fully_qualified_name() -> &'static str {
+ "MyGame.Example.TypeAliases"
+ }
+
#[inline]
pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
TypeAliases {
@@ -1778,8 +2127,8 @@
pub u64_: u64,
pub f32_: f32,
pub f64_: f64,
- pub v8: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , i8>>>,
- pub vf64: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a , f64>>>,
+ pub v8: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, i8>>>,
+ pub vf64: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, f64>>>,
}
impl<'a> Default for TypeAliasesArgs<'a> {
#[inline]
@@ -1868,6 +2217,24 @@
}
}
+impl std::fmt::Debug for TypeAliases<'_> {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ let mut ds = f.debug_struct("TypeAliases");
+ ds.field("i8_", &self.i8_());
+ ds.field("u8_", &self.u8_());
+ ds.field("i16_", &self.i16_());
+ ds.field("u16_", &self.u16_());
+ ds.field("i32_", &self.i32_());
+ ds.field("u32_", &self.u32_());
+ ds.field("i64_", &self.i64_());
+ ds.field("u64_", &self.u64_());
+ ds.field("f32_", &self.f32_());
+ ds.field("f64_", &self.f64_());
+ ds.field("v8", &self.v8());
+ ds.field("vf64", &self.vf64());
+ ds.finish()
+ }
+}
#[inline]
pub fn get_root_as_monster<'a>(buf: &'a [u8]) -> Monster<'a> {
flatbuffers::get_root::<Monster<'a>>(buf)
@@ -1878,19 +2245,19 @@
flatbuffers::get_size_prefixed_root::<Monster<'a>>(buf)
}
-pub const MONSTER_IDENTIFIER: &'static str = "MONS";
+pub const MONSTER_IDENTIFIER: &str = "MONS";
#[inline]
pub fn monster_buffer_has_identifier(buf: &[u8]) -> bool {
- return flatbuffers::buffer_has_identifier(buf, MONSTER_IDENTIFIER, false);
+ flatbuffers::buffer_has_identifier(buf, MONSTER_IDENTIFIER, false)
}
#[inline]
pub fn monster_size_prefixed_buffer_has_identifier(buf: &[u8]) -> bool {
- return flatbuffers::buffer_has_identifier(buf, MONSTER_IDENTIFIER, true);
+ flatbuffers::buffer_has_identifier(buf, MONSTER_IDENTIFIER, true)
}
-pub const MONSTER_EXTENSION: &'static str = "mon";
+pub const MONSTER_EXTENSION: &str = "mon";
#[inline]
pub fn finish_monster_buffer<'a, 'b>(