diff --git a/src/idl_gen_rust.cpp b/src/idl_gen_rust.cpp index 9d31265a4..ccfb376bf 100644 --- a/src/idl_gen_rust.cpp +++ b/src/idl_gen_rust.cpp @@ -586,7 +586,7 @@ class RustGenerator : public BaseGenerator { GenComment(enum_def.doc_comment); code_ += "#[allow(non_camel_case_types)]"; code_ += "#[repr({{BASE_TYPE}})]"; - code_ += "#[derive(Clone, Copy, PartialEq, Debug)]"; + code_ += "#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]"; code_ += "pub enum " + Name(enum_def) + " {"; int64_t anyv = 0; @@ -1027,11 +1027,11 @@ class RustGenerator : public BaseGenerator { } case ftVectorOfTable: { const auto typname = WrapInNameSpace(*type.struct_def); - return WrapInOptionIfNotRequired("flatbuffers::Vector>>", field.required); } case ftVectorOfString: { - return WrapInOptionIfNotRequired("flatbuffers::Vector>", field.required); } case ftVectorOfUnionValue: { diff --git a/tests/monster_test_generated.rs b/tests/monster_test_generated.rs index 8b18e968c..49db42d9a 100644 --- a/tests/monster_test_generated.rs +++ b/tests/monster_test_generated.rs @@ -170,7 +170,7 @@ pub mod example { #[allow(non_camel_case_types)] #[repr(i8)] -#[derive(Clone, Copy, PartialEq, Debug)] +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] pub enum Color { Red = 1, Green = 2, @@ -238,7 +238,7 @@ pub fn enum_name_color(e: Color) -> &'static str { #[allow(non_camel_case_types)] #[repr(u8)] -#[derive(Clone, Copy, PartialEq, Debug)] +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] pub enum Any { NONE = 0, Monster = 1, @@ -305,7 +305,7 @@ pub fn enum_name_any(e: Any) -> &'static str { pub struct AnyUnionTableOffset {} #[allow(non_camel_case_types)] #[repr(u8)] -#[derive(Clone, Copy, PartialEq, Debug)] +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] pub enum AnyUniqueAliases { NONE = 0, M = 1, @@ -372,7 +372,7 @@ pub fn enum_name_any_unique_aliases(e: AnyUniqueAliases) -> &'static str { pub struct AnyUniqueAliasesUnionTableOffset {} #[allow(non_camel_case_types)] #[repr(u8)] -#[derive(Clone, Copy, PartialEq, Debug)] +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] pub enum AnyAmbiguousAliases { NONE = 0, M1 = 1, @@ -1095,13 +1095,13 @@ impl<'a> Monster<'a> { self._tab.get::>>(Monster::VT_TEST4, None).map(|v| v.safe_slice() ) } #[inline] - pub fn testarrayofstring(&self) -> Option>> { + pub fn testarrayofstring(&self) -> Option>> { self._tab.get::>>>(Monster::VT_TESTARRAYOFSTRING, None) } /// an example documentation comment: this will end up in the generated code /// multiline too #[inline] - pub fn testarrayoftables(&self) -> Option>>> { + pub fn testarrayoftables(&self) -> Option>>> { self._tab.get::>>>>(Monster::VT_TESTARRAYOFTABLES, None) } #[inline] @@ -1178,7 +1178,7 @@ impl<'a> Monster<'a> { self._tab.get::(Monster::VT_TESTF3, Some(0.0)).unwrap() } #[inline] - pub fn testarrayofstring2(&self) -> Option>> { + pub fn testarrayofstring2(&self) -> Option>> { self._tab.get::>>>(Monster::VT_TESTARRAYOFSTRING2, None) } #[inline] @@ -1206,7 +1206,7 @@ impl<'a> Monster<'a> { self._tab.get::>>(Monster::VT_PARENT_NAMESPACE_TEST, None) } #[inline] - pub fn vector_of_referrables(&self) -> Option>>> { + pub fn vector_of_referrables(&self) -> Option>>> { self._tab.get::>>>>(Monster::VT_VECTOR_OF_REFERRABLES, None) } #[inline] @@ -1218,7 +1218,7 @@ impl<'a> Monster<'a> { self._tab.get::>>(Monster::VT_VECTOR_OF_WEAK_REFERENCES, None) } #[inline] - pub fn vector_of_strong_referrables(&self) -> Option>>> { + pub fn vector_of_strong_referrables(&self) -> Option>>> { self._tab.get::>>>>(Monster::VT_VECTOR_OF_STRONG_REFERRABLES, None) } #[inline] diff --git a/tests/namespace_test/namespace_test1_generated.rs b/tests/namespace_test/namespace_test1_generated.rs index 7fb6c9784..9df2fcc6d 100644 --- a/tests/namespace_test/namespace_test1_generated.rs +++ b/tests/namespace_test/namespace_test1_generated.rs @@ -31,7 +31,7 @@ pub mod namespace_b { #[allow(non_camel_case_types)] #[repr(i8)] -#[derive(Clone, Copy, PartialEq, Debug)] +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] pub enum EnumInNestedNS { A = 0, B = 1,