diff options
author | Casper <casperneo@uchicago.edu> | 2020-10-29 12:57:29 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-29 12:57:29 -0700 |
commit | b08b0a440226540a5157bb7ec1e82644ef228004 (patch) | |
tree | ca418f1fea9dcc00731207e4767242abe8e07589 /tests/namespace_test/namespace_test2_generated.rs | |
parent | 17ae48decc9101beaa850e1208ea067ed0da26c3 (diff) | |
download | flatbuffers-b08b0a440226540a5157bb7ec1e82644ef228004.tar.gz flatbuffers-b08b0a440226540a5157bb7ec1e82644ef228004.tar.bz2 flatbuffers-b08b0a440226540a5157bb7ec1e82644ef228004.zip |
Implement `Debug` trait for Rust flatbuffers. (#6207)
* Refactor idl_gen_rust to a ForAllX continuation pattern.
* Removed unneeded SetValue and updated sample rust gencode
* Make Rust flatbuffers print right
* Generated code and removed unnecessary trait constraint
* bumped rust version. Release required
* removed an unwrap in Rust Debug-print unions
* Tested formatting flatbuffers in rust.
* Set float precision in flaky debug-print test
* impl Debug for structs too
Co-authored-by: Casper Neo <cneo@google.com>
Diffstat (limited to 'tests/namespace_test/namespace_test2_generated.rs')
-rw-r--r-- | tests/namespace_test/namespace_test2_generated.rs | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/tests/namespace_test/namespace_test2_generated.rs b/tests/namespace_test/namespace_test2_generated.rs index c14f189c..b1d84cf0 100644 --- a/tests/namespace_test/namespace_test2_generated.rs +++ b/tests/namespace_test/namespace_test2_generated.rs @@ -21,7 +21,7 @@ pub mod namespace_a { use self::flatbuffers::EndianScalar; pub enum TableInFirstNSOffset {} -#[derive(Copy, Clone, Debug, PartialEq)] +#[derive(Copy, Clone, PartialEq)] pub struct TableInFirstNS<'a> { pub _tab: flatbuffers::Table<'a>, @@ -122,8 +122,17 @@ impl<'a: 'b, 'b> TableInFirstNSBuilder<'a, 'b> { } } +impl std::fmt::Debug for TableInFirstNS<'_> { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let mut ds = f.debug_struct("TableInFirstNS"); + ds.field("foo_table", &self.foo_table()); + ds.field("foo_enum", &self.foo_enum()); + ds.field("foo_struct", &self.foo_struct()); + ds.finish() + } +} pub enum SecondTableInAOffset {} -#[derive(Copy, Clone, Debug, PartialEq)] +#[derive(Copy, Clone, PartialEq)] pub struct SecondTableInA<'a> { pub _tab: flatbuffers::Table<'a>, @@ -200,6 +209,13 @@ impl<'a: 'b, 'b> SecondTableInABuilder<'a, 'b> { } } +impl std::fmt::Debug for SecondTableInA<'_> { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let mut ds = f.debug_struct("SecondTableInA"); + ds.field("refer_to_c", &self.refer_to_c()); + ds.finish() + } +} } // pub mod NamespaceA #[allow(unused_imports, dead_code)] @@ -213,7 +229,7 @@ pub mod namespace_c { use self::flatbuffers::EndianScalar; pub enum TableInCOffset {} -#[derive(Copy, Clone, Debug, PartialEq)] +#[derive(Copy, Clone, PartialEq)] pub struct TableInC<'a> { pub _tab: flatbuffers::Table<'a>, @@ -302,5 +318,13 @@ impl<'a: 'b, 'b> TableInCBuilder<'a, 'b> { } } +impl std::fmt::Debug for TableInC<'_> { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let mut ds = f.debug_struct("TableInC"); + ds.field("refer_to_a1", &self.refer_to_a1()); + ds.field("refer_to_a2", &self.refer_to_a2()); + ds.finish() + } +} } // pub mod NamespaceC |