From cb14043f820271287ec0a487467612c1932c80f9 Mon Sep 17 00:00:00 2001 From: sssooonnnggg Date: Thu, 18 May 2023 01:54:49 +0800 Subject: [PATCH] fix(rust): fixed rust namer isses, resolve #7865 and ##7782 (#7964) Co-authored-by: Derek Bailey --- scripts/generate_code.py | 6 + src/idl_namer.h | 3 +- tests/rust_namer_test.fbs | 27 ++ tests/rust_namer_test/mod.rs | 21 ++ .../rust_namer_test/field_table_generated.rs | 117 ++++++++ .../rust_namer_test/field_union_generated.rs | 145 ++++++++++ .../rust_namer_test/game_message_generated.rs | 201 ++++++++++++++ .../game_message_wrapper_generated.rs | 255 ++++++++++++++++++ .../player_input_change_generated.rs | 117 ++++++++ .../player_spectate_generated.rs | 117 ++++++++ .../player_stat_event_generated.rs | 117 ++++++++ .../rust_namer_test/root_table_generated.rs | 199 ++++++++++++++ .../rust_usage_test/tests/integration_test.rs | 5 + 13 files changed, 1329 insertions(+), 1 deletion(-) create mode 100644 tests/rust_namer_test.fbs create mode 100644 tests/rust_namer_test/mod.rs create mode 100644 tests/rust_namer_test/rust_namer_test/field_table_generated.rs create mode 100644 tests/rust_namer_test/rust_namer_test/field_union_generated.rs create mode 100644 tests/rust_namer_test/rust_namer_test/game_message_generated.rs create mode 100644 tests/rust_namer_test/rust_namer_test/game_message_wrapper_generated.rs create mode 100644 tests/rust_namer_test/rust_namer_test/player_input_change_generated.rs create mode 100644 tests/rust_namer_test/rust_namer_test/player_spectate_generated.rs create mode 100644 tests/rust_namer_test/rust_namer_test/player_stat_event_generated.rs create mode 100644 tests/rust_namer_test/rust_namer_test/root_table_generated.rs diff --git a/scripts/generate_code.py b/scripts/generate_code.py index 57af85ca56e..772cdf4744c 100755 --- a/scripts/generate_code.py +++ b/scripts/generate_code.py @@ -339,6 +339,12 @@ def glob(path, pattern): schema="arrays_test.fbs", ) +flatc( + RUST_OPTS, + prefix="rust_namer_test", + schema="rust_namer_test.fbs", +) + flatc( BASE_OPTS + PYTHON_OPTS, schema="arrays_test.fbs", diff --git a/src/idl_namer.h b/src/idl_namer.h index 7f89433da65..337ac920b57 100644 --- a/src/idl_namer.h +++ b/src/idl_namer.h @@ -146,7 +146,8 @@ class IdlNamer : public Namer { std::string LegacyRustUnionTypeMethod(const FieldDef &d) { // assert d is a union - return Method(d.name + "_type"); + // d should convert case but not escape keywords due to historical reasons + return ConvertCase(d.name, config_.fields, Case::kLowerCamel) + "_type"; } private: diff --git a/tests/rust_namer_test.fbs b/tests/rust_namer_test.fbs new file mode 100644 index 00000000000..646abcb9d4b --- /dev/null +++ b/tests/rust_namer_test.fbs @@ -0,0 +1,27 @@ +namespace RustNamerTest; + +table FieldTable {} + +union FieldUnion { + f :FieldTable (id: 0), +} + +table RootTable { + field42 :FieldUnion (id: 1); +} + +table PlayerStatEvent {} +table PlayerSpectate {} +table PlayerInputChange {} + +union GameMessage +{ + PlayerStatEvent, + PlayerSpectate, + PlayerInputChange +} + +table GameMessageWrapper +{ + Message:GameMessage; +} \ No newline at end of file diff --git a/tests/rust_namer_test/mod.rs b/tests/rust_namer_test/mod.rs new file mode 100644 index 00000000000..264a2c09168 --- /dev/null +++ b/tests/rust_namer_test/mod.rs @@ -0,0 +1,21 @@ +// Automatically generated by the Flatbuffers compiler. Do not modify. +// @generated +pub mod rust_namer_test { + use super::*; + mod field_union_generated; + pub use self::field_union_generated::*; + mod game_message_generated; + pub use self::game_message_generated::*; + mod field_table_generated; + pub use self::field_table_generated::*; + mod root_table_generated; + pub use self::root_table_generated::*; + mod player_stat_event_generated; + pub use self::player_stat_event_generated::*; + mod player_spectate_generated; + pub use self::player_spectate_generated::*; + mod player_input_change_generated; + pub use self::player_input_change_generated::*; + mod game_message_wrapper_generated; + pub use self::game_message_wrapper_generated::*; +} // rust_namer_test diff --git a/tests/rust_namer_test/rust_namer_test/field_table_generated.rs b/tests/rust_namer_test/rust_namer_test/field_table_generated.rs new file mode 100644 index 00000000000..d8034ef0ed5 --- /dev/null +++ b/tests/rust_namer_test/rust_namer_test/field_table_generated.rs @@ -0,0 +1,117 @@ +// automatically generated by the FlatBuffers compiler, do not modify +// @generated +extern crate alloc; +extern crate flatbuffers; +use alloc::boxed::Box; +use alloc::string::{String, ToString}; +use alloc::vec::Vec; +use core::mem; +use core::cmp::Ordering; +use self::flatbuffers::{EndianScalar, Follow}; +use super::*; +pub enum FieldTableOffset {} +#[derive(Copy, Clone, PartialEq)] + +pub struct FieldTable<'a> { + pub _tab: flatbuffers::Table<'a>, +} + +impl<'a> flatbuffers::Follow<'a> for FieldTable<'a> { + type Inner = FieldTable<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { _tab: flatbuffers::Table::new(buf, loc) } + } +} + +impl<'a> FieldTable<'a> { + + pub const fn get_fully_qualified_name() -> &'static str { + "RustNamerTest.FieldTable" + } + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + FieldTable { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + _args: &'args FieldTableArgs + ) -> flatbuffers::WIPOffset> { + let mut builder = FieldTableBuilder::new(_fbb); + builder.finish() + } + + pub fn unpack(&self) -> FieldTableT { + FieldTableT { + } + } +} + +impl flatbuffers::Verifiable for FieldTable<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, pos: usize + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .finish(); + Ok(()) + } +} +pub struct FieldTableArgs { +} +impl<'a> Default for FieldTableArgs { + #[inline] + fn default() -> Self { + FieldTableArgs { + } + } +} + +pub struct FieldTableBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, +} +impl<'a: 'b, 'b> FieldTableBuilder<'a, 'b> { + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> FieldTableBuilder<'a, 'b> { + let start = _fbb.start_table(); + FieldTableBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + flatbuffers::WIPOffset::new(o.value()) + } +} + +impl core::fmt::Debug for FieldTable<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("FieldTable"); + ds.finish() + } +} +#[non_exhaustive] +#[derive(Debug, Clone, PartialEq)] +pub struct FieldTableT { +} +impl Default for FieldTableT { + fn default() -> Self { + Self { + } + } +} +impl FieldTableT { + pub fn pack<'b>( + &self, + _fbb: &mut flatbuffers::FlatBufferBuilder<'b> + ) -> flatbuffers::WIPOffset> { + FieldTable::create(_fbb, &FieldTableArgs{ + }) + } +} diff --git a/tests/rust_namer_test/rust_namer_test/field_union_generated.rs b/tests/rust_namer_test/rust_namer_test/field_union_generated.rs new file mode 100644 index 00000000000..f5d866210ba --- /dev/null +++ b/tests/rust_namer_test/rust_namer_test/field_union_generated.rs @@ -0,0 +1,145 @@ +// automatically generated by the FlatBuffers compiler, do not modify +// @generated +extern crate alloc; +extern crate flatbuffers; +use alloc::boxed::Box; +use alloc::string::{String, ToString}; +use alloc::vec::Vec; +use core::mem; +use core::cmp::Ordering; +use self::flatbuffers::{EndianScalar, Follow}; +use super::*; +#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] +pub const ENUM_MIN_FIELD_UNION: u8 = 0; +#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] +pub const ENUM_MAX_FIELD_UNION: u8 = 1; +#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] +#[allow(non_camel_case_types)] +pub const ENUM_VALUES_FIELD_UNION: [FieldUnion; 2] = [ + FieldUnion::NONE, + FieldUnion::f, +]; + +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] +#[repr(transparent)] +pub struct FieldUnion(pub u8); +#[allow(non_upper_case_globals)] +impl FieldUnion { + pub const NONE: Self = Self(0); + pub const f: Self = Self(1); + + pub const ENUM_MIN: u8 = 0; + pub const ENUM_MAX: u8 = 1; + pub const ENUM_VALUES: &'static [Self] = &[ + Self::NONE, + Self::f, + ]; + /// Returns the variant's name or "" if unknown. + pub fn variant_name(self) -> Option<&'static str> { + match self { + Self::NONE => Some("NONE"), + Self::f => Some("f"), + _ => None, + } + } +} +impl core::fmt::Debug for FieldUnion { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { + if let Some(name) = self.variant_name() { + f.write_str(name) + } else { + f.write_fmt(format_args!("", self.0)) + } + } +} +impl<'a> flatbuffers::Follow<'a> for FieldUnion { + type Inner = Self; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + let b = flatbuffers::read_scalar_at::(buf, loc); + Self(b) + } +} + +impl flatbuffers::Push for FieldUnion { + type Output = FieldUnion; + #[inline] + unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { + flatbuffers::emplace_scalar::(dst, self.0); + } +} + +impl flatbuffers::EndianScalar for FieldUnion { + type Scalar = u8; + #[inline] + fn to_little_endian(self) -> u8 { + self.0.to_le() + } + #[inline] + #[allow(clippy::wrong_self_convention)] + fn from_little_endian(v: u8) -> Self { + let b = u8::from_le(v); + Self(b) + } +} + +impl<'a> flatbuffers::Verifiable for FieldUnion { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, pos: usize + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + u8::run_verifier(v, pos) + } +} + +impl flatbuffers::SimpleToVerifyInSlice for FieldUnion {} +pub struct FieldUnionUnionTableOffset {} + +#[allow(clippy::upper_case_acronyms)] +#[non_exhaustive] +#[derive(Debug, Clone, PartialEq)] +pub enum FieldUnionT { + NONE, + F(Box), +} +impl Default for FieldUnionT { + fn default() -> Self { + Self::NONE + } +} +impl FieldUnionT { + pub fn field_union_type(&self) -> FieldUnion { + match self { + Self::NONE => FieldUnion::NONE, + Self::F(_) => FieldUnion::f, + } + } + pub fn pack(&self, fbb: &mut flatbuffers::FlatBufferBuilder) -> Option> { + match self { + Self::NONE => None, + Self::F(v) => Some(v.pack(fbb).as_union_value()), + } + } + /// If the union variant matches, return the owned FieldTableT, setting the union to NONE. + pub fn take_f(&mut self) -> Option> { + if let Self::F(_) = self { + let v = core::mem::replace(self, Self::NONE); + if let Self::F(w) = v { + Some(w) + } else { + unreachable!() + } + } else { + None + } + } + /// If the union variant matches, return a reference to the FieldTableT. + pub fn as_f(&self) -> Option<&FieldTableT> { + if let Self::F(v) = self { Some(v.as_ref()) } else { None } + } + /// If the union variant matches, return a mutable reference to the FieldTableT. + pub fn as_f_mut(&mut self) -> Option<&mut FieldTableT> { + if let Self::F(v) = self { Some(v.as_mut()) } else { None } + } +} diff --git a/tests/rust_namer_test/rust_namer_test/game_message_generated.rs b/tests/rust_namer_test/rust_namer_test/game_message_generated.rs new file mode 100644 index 00000000000..b6bf9eae12f --- /dev/null +++ b/tests/rust_namer_test/rust_namer_test/game_message_generated.rs @@ -0,0 +1,201 @@ +// automatically generated by the FlatBuffers compiler, do not modify +// @generated +extern crate alloc; +extern crate flatbuffers; +use alloc::boxed::Box; +use alloc::string::{String, ToString}; +use alloc::vec::Vec; +use core::mem; +use core::cmp::Ordering; +use self::flatbuffers::{EndianScalar, Follow}; +use super::*; +#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] +pub const ENUM_MIN_GAME_MESSAGE: u8 = 0; +#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] +pub const ENUM_MAX_GAME_MESSAGE: u8 = 3; +#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] +#[allow(non_camel_case_types)] +pub const ENUM_VALUES_GAME_MESSAGE: [GameMessage; 4] = [ + GameMessage::NONE, + GameMessage::PlayerStatEvent, + GameMessage::PlayerSpectate, + GameMessage::PlayerInputChange, +]; + +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] +#[repr(transparent)] +pub struct GameMessage(pub u8); +#[allow(non_upper_case_globals)] +impl GameMessage { + pub const NONE: Self = Self(0); + pub const PlayerStatEvent: Self = Self(1); + pub const PlayerSpectate: Self = Self(2); + pub const PlayerInputChange: Self = Self(3); + + pub const ENUM_MIN: u8 = 0; + pub const ENUM_MAX: u8 = 3; + pub const ENUM_VALUES: &'static [Self] = &[ + Self::NONE, + Self::PlayerStatEvent, + Self::PlayerSpectate, + Self::PlayerInputChange, + ]; + /// Returns the variant's name or "" if unknown. + pub fn variant_name(self) -> Option<&'static str> { + match self { + Self::NONE => Some("NONE"), + Self::PlayerStatEvent => Some("PlayerStatEvent"), + Self::PlayerSpectate => Some("PlayerSpectate"), + Self::PlayerInputChange => Some("PlayerInputChange"), + _ => None, + } + } +} +impl core::fmt::Debug for GameMessage { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { + if let Some(name) = self.variant_name() { + f.write_str(name) + } else { + f.write_fmt(format_args!("", self.0)) + } + } +} +impl<'a> flatbuffers::Follow<'a> for GameMessage { + type Inner = Self; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + let b = flatbuffers::read_scalar_at::(buf, loc); + Self(b) + } +} + +impl flatbuffers::Push for GameMessage { + type Output = GameMessage; + #[inline] + unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { + flatbuffers::emplace_scalar::(dst, self.0); + } +} + +impl flatbuffers::EndianScalar for GameMessage { + type Scalar = u8; + #[inline] + fn to_little_endian(self) -> u8 { + self.0.to_le() + } + #[inline] + #[allow(clippy::wrong_self_convention)] + fn from_little_endian(v: u8) -> Self { + let b = u8::from_le(v); + Self(b) + } +} + +impl<'a> flatbuffers::Verifiable for GameMessage { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, pos: usize + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + u8::run_verifier(v, pos) + } +} + +impl flatbuffers::SimpleToVerifyInSlice for GameMessage {} +pub struct GameMessageUnionTableOffset {} + +#[allow(clippy::upper_case_acronyms)] +#[non_exhaustive] +#[derive(Debug, Clone, PartialEq)] +pub enum GameMessageT { + NONE, + PlayerStatEvent(Box), + PlayerSpectate(Box), + PlayerInputChange(Box), +} +impl Default for GameMessageT { + fn default() -> Self { + Self::NONE + } +} +impl GameMessageT { + pub fn game_message_type(&self) -> GameMessage { + match self { + Self::NONE => GameMessage::NONE, + Self::PlayerStatEvent(_) => GameMessage::PlayerStatEvent, + Self::PlayerSpectate(_) => GameMessage::PlayerSpectate, + Self::PlayerInputChange(_) => GameMessage::PlayerInputChange, + } + } + pub fn pack(&self, fbb: &mut flatbuffers::FlatBufferBuilder) -> Option> { + match self { + Self::NONE => None, + Self::PlayerStatEvent(v) => Some(v.pack(fbb).as_union_value()), + Self::PlayerSpectate(v) => Some(v.pack(fbb).as_union_value()), + Self::PlayerInputChange(v) => Some(v.pack(fbb).as_union_value()), + } + } + /// If the union variant matches, return the owned PlayerStatEventT, setting the union to NONE. + pub fn take_player_stat_event(&mut self) -> Option> { + if let Self::PlayerStatEvent(_) = self { + let v = core::mem::replace(self, Self::NONE); + if let Self::PlayerStatEvent(w) = v { + Some(w) + } else { + unreachable!() + } + } else { + None + } + } + /// If the union variant matches, return a reference to the PlayerStatEventT. + pub fn as_player_stat_event(&self) -> Option<&PlayerStatEventT> { + if let Self::PlayerStatEvent(v) = self { Some(v.as_ref()) } else { None } + } + /// If the union variant matches, return a mutable reference to the PlayerStatEventT. + pub fn as_player_stat_event_mut(&mut self) -> Option<&mut PlayerStatEventT> { + if let Self::PlayerStatEvent(v) = self { Some(v.as_mut()) } else { None } + } + /// If the union variant matches, return the owned PlayerSpectateT, setting the union to NONE. + pub fn take_player_spectate(&mut self) -> Option> { + if let Self::PlayerSpectate(_) = self { + let v = core::mem::replace(self, Self::NONE); + if let Self::PlayerSpectate(w) = v { + Some(w) + } else { + unreachable!() + } + } else { + None + } + } + /// If the union variant matches, return a reference to the PlayerSpectateT. + pub fn as_player_spectate(&self) -> Option<&PlayerSpectateT> { + if let Self::PlayerSpectate(v) = self { Some(v.as_ref()) } else { None } + } + /// If the union variant matches, return a mutable reference to the PlayerSpectateT. + pub fn as_player_spectate_mut(&mut self) -> Option<&mut PlayerSpectateT> { + if let Self::PlayerSpectate(v) = self { Some(v.as_mut()) } else { None } + } + /// If the union variant matches, return the owned PlayerInputChangeT, setting the union to NONE. + pub fn take_player_input_change(&mut self) -> Option> { + if let Self::PlayerInputChange(_) = self { + let v = core::mem::replace(self, Self::NONE); + if let Self::PlayerInputChange(w) = v { + Some(w) + } else { + unreachable!() + } + } else { + None + } + } + /// If the union variant matches, return a reference to the PlayerInputChangeT. + pub fn as_player_input_change(&self) -> Option<&PlayerInputChangeT> { + if let Self::PlayerInputChange(v) = self { Some(v.as_ref()) } else { None } + } + /// If the union variant matches, return a mutable reference to the PlayerInputChangeT. + pub fn as_player_input_change_mut(&mut self) -> Option<&mut PlayerInputChangeT> { + if let Self::PlayerInputChange(v) = self { Some(v.as_mut()) } else { None } + } +} diff --git a/tests/rust_namer_test/rust_namer_test/game_message_wrapper_generated.rs b/tests/rust_namer_test/rust_namer_test/game_message_wrapper_generated.rs new file mode 100644 index 00000000000..05d8fa32ef6 --- /dev/null +++ b/tests/rust_namer_test/rust_namer_test/game_message_wrapper_generated.rs @@ -0,0 +1,255 @@ +// automatically generated by the FlatBuffers compiler, do not modify +// @generated +extern crate alloc; +extern crate flatbuffers; +use alloc::boxed::Box; +use alloc::string::{String, ToString}; +use alloc::vec::Vec; +use core::mem; +use core::cmp::Ordering; +use self::flatbuffers::{EndianScalar, Follow}; +use super::*; +pub enum GameMessageWrapperOffset {} +#[derive(Copy, Clone, PartialEq)] + +pub struct GameMessageWrapper<'a> { + pub _tab: flatbuffers::Table<'a>, +} + +impl<'a> flatbuffers::Follow<'a> for GameMessageWrapper<'a> { + type Inner = GameMessageWrapper<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { _tab: flatbuffers::Table::new(buf, loc) } + } +} + +impl<'a> GameMessageWrapper<'a> { + pub const VT_MESSAGE_TYPE: flatbuffers::VOffsetT = 4; + pub const VT_MESSAGE: flatbuffers::VOffsetT = 6; + + pub const fn get_fully_qualified_name() -> &'static str { + "RustNamerTest.GameMessageWrapper" + } + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + GameMessageWrapper { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args GameMessageWrapperArgs + ) -> flatbuffers::WIPOffset> { + let mut builder = GameMessageWrapperBuilder::new(_fbb); + if let Some(x) = args.Message { builder.add_Message(x); } + builder.add_Message_type(args.Message_type); + builder.finish() + } + + pub fn unpack(&self) -> GameMessageWrapperT { + let Message = match self.Message_type() { + GameMessage::NONE => GameMessageT::NONE, + GameMessage::PlayerStatEvent => GameMessageT::PlayerStatEvent(Box::new( + self.Message_as_player_stat_event() + .expect("Invalid union table, expected `GameMessage::PlayerStatEvent`.") + .unpack() + )), + GameMessage::PlayerSpectate => GameMessageT::PlayerSpectate(Box::new( + self.Message_as_player_spectate() + .expect("Invalid union table, expected `GameMessage::PlayerSpectate`.") + .unpack() + )), + GameMessage::PlayerInputChange => GameMessageT::PlayerInputChange(Box::new( + self.Message_as_player_input_change() + .expect("Invalid union table, expected `GameMessage::PlayerInputChange`.") + .unpack() + )), + _ => GameMessageT::NONE, + }; + GameMessageWrapperT { + Message, + } + } + + #[inline] + pub fn Message_type(&self) -> GameMessage { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(GameMessageWrapper::VT_MESSAGE_TYPE, Some(GameMessage::NONE)).unwrap()} + } + #[inline] + pub fn Message(&self) -> Option> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::>>(GameMessageWrapper::VT_MESSAGE, None)} + } + #[inline] + #[allow(non_snake_case)] + pub fn Message_as_player_stat_event(&self) -> Option> { + if self.Message_type() == GameMessage::PlayerStatEvent { + self.Message().map(|t| { + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + unsafe { PlayerStatEvent::init_from_table(t) } + }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn Message_as_player_spectate(&self) -> Option> { + if self.Message_type() == GameMessage::PlayerSpectate { + self.Message().map(|t| { + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + unsafe { PlayerSpectate::init_from_table(t) } + }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn Message_as_player_input_change(&self) -> Option> { + if self.Message_type() == GameMessage::PlayerInputChange { + self.Message().map(|t| { + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + unsafe { PlayerInputChange::init_from_table(t) } + }) + } else { + None + } + } + +} + +impl flatbuffers::Verifiable for GameMessageWrapper<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, pos: usize + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_union::("Message_type", Self::VT_MESSAGE_TYPE, "Message", Self::VT_MESSAGE, false, |key, v, pos| { + match key { + GameMessage::PlayerStatEvent => v.verify_union_variant::>("GameMessage::PlayerStatEvent", pos), + GameMessage::PlayerSpectate => v.verify_union_variant::>("GameMessage::PlayerSpectate", pos), + GameMessage::PlayerInputChange => v.verify_union_variant::>("GameMessage::PlayerInputChange", pos), + _ => Ok(()), + } + })? + .finish(); + Ok(()) + } +} +pub struct GameMessageWrapperArgs { + pub Message_type: GameMessage, + pub Message: Option>, +} +impl<'a> Default for GameMessageWrapperArgs { + #[inline] + fn default() -> Self { + GameMessageWrapperArgs { + Message_type: GameMessage::NONE, + Message: None, + } + } +} + +pub struct GameMessageWrapperBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, +} +impl<'a: 'b, 'b> GameMessageWrapperBuilder<'a, 'b> { + #[inline] + pub fn add_Message_type(&mut self, Message_type: GameMessage) { + self.fbb_.push_slot::(GameMessageWrapper::VT_MESSAGE_TYPE, Message_type, GameMessage::NONE); + } + #[inline] + pub fn add_Message(&mut self, Message: flatbuffers::WIPOffset) { + self.fbb_.push_slot_always::>(GameMessageWrapper::VT_MESSAGE, Message); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> GameMessageWrapperBuilder<'a, 'b> { + let start = _fbb.start_table(); + GameMessageWrapperBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + flatbuffers::WIPOffset::new(o.value()) + } +} + +impl core::fmt::Debug for GameMessageWrapper<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("GameMessageWrapper"); + ds.field("Message_type", &self.Message_type()); + match self.Message_type() { + GameMessage::PlayerStatEvent => { + if let Some(x) = self.Message_as_player_stat_event() { + ds.field("Message", &x) + } else { + ds.field("Message", &"InvalidFlatbuffer: Union discriminant does not match value.") + } + }, + GameMessage::PlayerSpectate => { + if let Some(x) = self.Message_as_player_spectate() { + ds.field("Message", &x) + } else { + ds.field("Message", &"InvalidFlatbuffer: Union discriminant does not match value.") + } + }, + GameMessage::PlayerInputChange => { + if let Some(x) = self.Message_as_player_input_change() { + ds.field("Message", &x) + } else { + ds.field("Message", &"InvalidFlatbuffer: Union discriminant does not match value.") + } + }, + _ => { + let x: Option<()> = None; + ds.field("Message", &x) + }, + }; + ds.finish() + } +} +#[non_exhaustive] +#[derive(Debug, Clone, PartialEq)] +pub struct GameMessageWrapperT { + pub Message: GameMessageT, +} +impl Default for GameMessageWrapperT { + fn default() -> Self { + Self { + Message: GameMessageT::NONE, + } + } +} +impl GameMessageWrapperT { + pub fn pack<'b>( + &self, + _fbb: &mut flatbuffers::FlatBufferBuilder<'b> + ) -> flatbuffers::WIPOffset> { + let Message_type = self.Message.game_message_type(); + let Message = self.Message.pack(_fbb); + GameMessageWrapper::create(_fbb, &GameMessageWrapperArgs{ + Message_type, + Message, + }) + } +} diff --git a/tests/rust_namer_test/rust_namer_test/player_input_change_generated.rs b/tests/rust_namer_test/rust_namer_test/player_input_change_generated.rs new file mode 100644 index 00000000000..2f57d80f95b --- /dev/null +++ b/tests/rust_namer_test/rust_namer_test/player_input_change_generated.rs @@ -0,0 +1,117 @@ +// automatically generated by the FlatBuffers compiler, do not modify +// @generated +extern crate alloc; +extern crate flatbuffers; +use alloc::boxed::Box; +use alloc::string::{String, ToString}; +use alloc::vec::Vec; +use core::mem; +use core::cmp::Ordering; +use self::flatbuffers::{EndianScalar, Follow}; +use super::*; +pub enum PlayerInputChangeOffset {} +#[derive(Copy, Clone, PartialEq)] + +pub struct PlayerInputChange<'a> { + pub _tab: flatbuffers::Table<'a>, +} + +impl<'a> flatbuffers::Follow<'a> for PlayerInputChange<'a> { + type Inner = PlayerInputChange<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { _tab: flatbuffers::Table::new(buf, loc) } + } +} + +impl<'a> PlayerInputChange<'a> { + + pub const fn get_fully_qualified_name() -> &'static str { + "RustNamerTest.PlayerInputChange" + } + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + PlayerInputChange { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + _args: &'args PlayerInputChangeArgs + ) -> flatbuffers::WIPOffset> { + let mut builder = PlayerInputChangeBuilder::new(_fbb); + builder.finish() + } + + pub fn unpack(&self) -> PlayerInputChangeT { + PlayerInputChangeT { + } + } +} + +impl flatbuffers::Verifiable for PlayerInputChange<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, pos: usize + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .finish(); + Ok(()) + } +} +pub struct PlayerInputChangeArgs { +} +impl<'a> Default for PlayerInputChangeArgs { + #[inline] + fn default() -> Self { + PlayerInputChangeArgs { + } + } +} + +pub struct PlayerInputChangeBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, +} +impl<'a: 'b, 'b> PlayerInputChangeBuilder<'a, 'b> { + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> PlayerInputChangeBuilder<'a, 'b> { + let start = _fbb.start_table(); + PlayerInputChangeBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + flatbuffers::WIPOffset::new(o.value()) + } +} + +impl core::fmt::Debug for PlayerInputChange<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("PlayerInputChange"); + ds.finish() + } +} +#[non_exhaustive] +#[derive(Debug, Clone, PartialEq)] +pub struct PlayerInputChangeT { +} +impl Default for PlayerInputChangeT { + fn default() -> Self { + Self { + } + } +} +impl PlayerInputChangeT { + pub fn pack<'b>( + &self, + _fbb: &mut flatbuffers::FlatBufferBuilder<'b> + ) -> flatbuffers::WIPOffset> { + PlayerInputChange::create(_fbb, &PlayerInputChangeArgs{ + }) + } +} diff --git a/tests/rust_namer_test/rust_namer_test/player_spectate_generated.rs b/tests/rust_namer_test/rust_namer_test/player_spectate_generated.rs new file mode 100644 index 00000000000..06e51106eb7 --- /dev/null +++ b/tests/rust_namer_test/rust_namer_test/player_spectate_generated.rs @@ -0,0 +1,117 @@ +// automatically generated by the FlatBuffers compiler, do not modify +// @generated +extern crate alloc; +extern crate flatbuffers; +use alloc::boxed::Box; +use alloc::string::{String, ToString}; +use alloc::vec::Vec; +use core::mem; +use core::cmp::Ordering; +use self::flatbuffers::{EndianScalar, Follow}; +use super::*; +pub enum PlayerSpectateOffset {} +#[derive(Copy, Clone, PartialEq)] + +pub struct PlayerSpectate<'a> { + pub _tab: flatbuffers::Table<'a>, +} + +impl<'a> flatbuffers::Follow<'a> for PlayerSpectate<'a> { + type Inner = PlayerSpectate<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { _tab: flatbuffers::Table::new(buf, loc) } + } +} + +impl<'a> PlayerSpectate<'a> { + + pub const fn get_fully_qualified_name() -> &'static str { + "RustNamerTest.PlayerSpectate" + } + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + PlayerSpectate { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + _args: &'args PlayerSpectateArgs + ) -> flatbuffers::WIPOffset> { + let mut builder = PlayerSpectateBuilder::new(_fbb); + builder.finish() + } + + pub fn unpack(&self) -> PlayerSpectateT { + PlayerSpectateT { + } + } +} + +impl flatbuffers::Verifiable for PlayerSpectate<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, pos: usize + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .finish(); + Ok(()) + } +} +pub struct PlayerSpectateArgs { +} +impl<'a> Default for PlayerSpectateArgs { + #[inline] + fn default() -> Self { + PlayerSpectateArgs { + } + } +} + +pub struct PlayerSpectateBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, +} +impl<'a: 'b, 'b> PlayerSpectateBuilder<'a, 'b> { + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> PlayerSpectateBuilder<'a, 'b> { + let start = _fbb.start_table(); + PlayerSpectateBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + flatbuffers::WIPOffset::new(o.value()) + } +} + +impl core::fmt::Debug for PlayerSpectate<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("PlayerSpectate"); + ds.finish() + } +} +#[non_exhaustive] +#[derive(Debug, Clone, PartialEq)] +pub struct PlayerSpectateT { +} +impl Default for PlayerSpectateT { + fn default() -> Self { + Self { + } + } +} +impl PlayerSpectateT { + pub fn pack<'b>( + &self, + _fbb: &mut flatbuffers::FlatBufferBuilder<'b> + ) -> flatbuffers::WIPOffset> { + PlayerSpectate::create(_fbb, &PlayerSpectateArgs{ + }) + } +} diff --git a/tests/rust_namer_test/rust_namer_test/player_stat_event_generated.rs b/tests/rust_namer_test/rust_namer_test/player_stat_event_generated.rs new file mode 100644 index 00000000000..a76bdfa739b --- /dev/null +++ b/tests/rust_namer_test/rust_namer_test/player_stat_event_generated.rs @@ -0,0 +1,117 @@ +// automatically generated by the FlatBuffers compiler, do not modify +// @generated +extern crate alloc; +extern crate flatbuffers; +use alloc::boxed::Box; +use alloc::string::{String, ToString}; +use alloc::vec::Vec; +use core::mem; +use core::cmp::Ordering; +use self::flatbuffers::{EndianScalar, Follow}; +use super::*; +pub enum PlayerStatEventOffset {} +#[derive(Copy, Clone, PartialEq)] + +pub struct PlayerStatEvent<'a> { + pub _tab: flatbuffers::Table<'a>, +} + +impl<'a> flatbuffers::Follow<'a> for PlayerStatEvent<'a> { + type Inner = PlayerStatEvent<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { _tab: flatbuffers::Table::new(buf, loc) } + } +} + +impl<'a> PlayerStatEvent<'a> { + + pub const fn get_fully_qualified_name() -> &'static str { + "RustNamerTest.PlayerStatEvent" + } + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + PlayerStatEvent { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + _args: &'args PlayerStatEventArgs + ) -> flatbuffers::WIPOffset> { + let mut builder = PlayerStatEventBuilder::new(_fbb); + builder.finish() + } + + pub fn unpack(&self) -> PlayerStatEventT { + PlayerStatEventT { + } + } +} + +impl flatbuffers::Verifiable for PlayerStatEvent<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, pos: usize + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .finish(); + Ok(()) + } +} +pub struct PlayerStatEventArgs { +} +impl<'a> Default for PlayerStatEventArgs { + #[inline] + fn default() -> Self { + PlayerStatEventArgs { + } + } +} + +pub struct PlayerStatEventBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, +} +impl<'a: 'b, 'b> PlayerStatEventBuilder<'a, 'b> { + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> PlayerStatEventBuilder<'a, 'b> { + let start = _fbb.start_table(); + PlayerStatEventBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + flatbuffers::WIPOffset::new(o.value()) + } +} + +impl core::fmt::Debug for PlayerStatEvent<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("PlayerStatEvent"); + ds.finish() + } +} +#[non_exhaustive] +#[derive(Debug, Clone, PartialEq)] +pub struct PlayerStatEventT { +} +impl Default for PlayerStatEventT { + fn default() -> Self { + Self { + } + } +} +impl PlayerStatEventT { + pub fn pack<'b>( + &self, + _fbb: &mut flatbuffers::FlatBufferBuilder<'b> + ) -> flatbuffers::WIPOffset> { + PlayerStatEvent::create(_fbb, &PlayerStatEventArgs{ + }) + } +} diff --git a/tests/rust_namer_test/rust_namer_test/root_table_generated.rs b/tests/rust_namer_test/rust_namer_test/root_table_generated.rs new file mode 100644 index 00000000000..a87ba0f483d --- /dev/null +++ b/tests/rust_namer_test/rust_namer_test/root_table_generated.rs @@ -0,0 +1,199 @@ +// automatically generated by the FlatBuffers compiler, do not modify +// @generated +extern crate alloc; +extern crate flatbuffers; +use alloc::boxed::Box; +use alloc::string::{String, ToString}; +use alloc::vec::Vec; +use core::mem; +use core::cmp::Ordering; +use self::flatbuffers::{EndianScalar, Follow}; +use super::*; +pub enum RootTableOffset {} +#[derive(Copy, Clone, PartialEq)] + +pub struct RootTable<'a> { + pub _tab: flatbuffers::Table<'a>, +} + +impl<'a> flatbuffers::Follow<'a> for RootTable<'a> { + type Inner = RootTable<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { _tab: flatbuffers::Table::new(buf, loc) } + } +} + +impl<'a> RootTable<'a> { + pub const VT_FIELD42_TYPE: flatbuffers::VOffsetT = 4; + pub const VT_FIELD42: flatbuffers::VOffsetT = 6; + + pub const fn get_fully_qualified_name() -> &'static str { + "RustNamerTest.RootTable" + } + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + RootTable { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, + args: &'args RootTableArgs + ) -> flatbuffers::WIPOffset> { + let mut builder = RootTableBuilder::new(_fbb); + if let Some(x) = args.field42 { builder.add_field42(x); } + builder.add_field42_type(args.field42_type); + builder.finish() + } + + pub fn unpack(&self) -> RootTableT { + let field42 = match self.field42_type() { + FieldUnion::NONE => FieldUnionT::NONE, + FieldUnion::f => FieldUnionT::F(Box::new( + self.field42_as_f() + .expect("Invalid union table, expected `FieldUnion::f`.") + .unpack() + )), + _ => FieldUnionT::NONE, + }; + RootTableT { + field42, + } + } + + #[inline] + pub fn field42_type(&self) -> FieldUnion { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(RootTable::VT_FIELD42_TYPE, Some(FieldUnion::NONE)).unwrap()} + } + #[inline] + pub fn field42(&self) -> Option> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::>>(RootTable::VT_FIELD42, None)} + } + #[inline] + #[allow(non_snake_case)] + pub fn field42_as_f(&self) -> Option> { + if self.field42_type() == FieldUnion::f { + self.field42().map(|t| { + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + unsafe { FieldTable::init_from_table(t) } + }) + } else { + None + } + } + +} + +impl flatbuffers::Verifiable for RootTable<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, pos: usize + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_union::("field42_type", Self::VT_FIELD42_TYPE, "field42", Self::VT_FIELD42, false, |key, v, pos| { + match key { + FieldUnion::f => v.verify_union_variant::>("FieldUnion::f", pos), + _ => Ok(()), + } + })? + .finish(); + Ok(()) + } +} +pub struct RootTableArgs { + pub field42_type: FieldUnion, + pub field42: Option>, +} +impl<'a> Default for RootTableArgs { + #[inline] + fn default() -> Self { + RootTableArgs { + field42_type: FieldUnion::NONE, + field42: None, + } + } +} + +pub struct RootTableBuilder<'a: 'b, 'b> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, + start_: flatbuffers::WIPOffset, +} +impl<'a: 'b, 'b> RootTableBuilder<'a, 'b> { + #[inline] + pub fn add_field42_type(&mut self, field42_type: FieldUnion) { + self.fbb_.push_slot::(RootTable::VT_FIELD42_TYPE, field42_type, FieldUnion::NONE); + } + #[inline] + pub fn add_field42(&mut self, field42: flatbuffers::WIPOffset) { + self.fbb_.push_slot_always::>(RootTable::VT_FIELD42, field42); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> RootTableBuilder<'a, 'b> { + let start = _fbb.start_table(); + RootTableBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + flatbuffers::WIPOffset::new(o.value()) + } +} + +impl core::fmt::Debug for RootTable<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("RootTable"); + ds.field("field42_type", &self.field42_type()); + match self.field42_type() { + FieldUnion::f => { + if let Some(x) = self.field42_as_f() { + ds.field("field42", &x) + } else { + ds.field("field42", &"InvalidFlatbuffer: Union discriminant does not match value.") + } + }, + _ => { + let x: Option<()> = None; + ds.field("field42", &x) + }, + }; + ds.finish() + } +} +#[non_exhaustive] +#[derive(Debug, Clone, PartialEq)] +pub struct RootTableT { + pub field42: FieldUnionT, +} +impl Default for RootTableT { + fn default() -> Self { + Self { + field42: FieldUnionT::NONE, + } + } +} +impl RootTableT { + pub fn pack<'b>( + &self, + _fbb: &mut flatbuffers::FlatBufferBuilder<'b> + ) -> flatbuffers::WIPOffset> { + let field42_type = self.field42.field_union_type(); + let field42 = self.field42.pack(_fbb); + RootTable::create(_fbb, &RootTableArgs{ + field42_type, + field42, + }) + } +} diff --git a/tests/rust_usage_test/tests/integration_test.rs b/tests/rust_usage_test/tests/integration_test.rs index fd92da3855b..89cacc1713a 100644 --- a/tests/rust_usage_test/tests/integration_test.rs +++ b/tests/rust_usage_test/tests/integration_test.rs @@ -78,6 +78,11 @@ mod arrays_test_generated; #[path = "../../keyword_test/mod.rs"] mod keyword_test_generated; +// Test rust namer, should not cause compiling issues +#[allow(dead_code, unused_imports, clippy::all)] +#[path = "../../rust_namer_test/mod.rs"] +mod rust_namer_test; + #[rustfmt::skip] // TODO: Use standard rust formatting and remove dead code. #[allow(dead_code)] mod flatbuffers_tests {