mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-01 19:58:15 +00:00
rust generator: fix enum member comments (#4911)
This commit is contained in:
@@ -555,7 +555,6 @@ class RustGenerator : public BaseGenerator {
|
||||
void GenEnum(const EnumDef &enum_def) {
|
||||
code_.SetValue("ENUM_NAME", Name(enum_def));
|
||||
code_.SetValue("BASE_TYPE", GetEnumTypeForDecl(enum_def.underlying_type));
|
||||
code_.SetValue("SEP", "");
|
||||
|
||||
GenComment(enum_def.doc_comment);
|
||||
code_ += "#[allow(non_camel_case_types)]";
|
||||
@@ -572,8 +571,7 @@ class RustGenerator : public BaseGenerator {
|
||||
GenComment(ev.doc_comment, " ");
|
||||
code_.SetValue("KEY", Name(ev));
|
||||
code_.SetValue("VALUE", NumToString(ev.value));
|
||||
code_ += "{{SEP}} {{KEY}} = {{VALUE}}\\";
|
||||
code_.SetValue("SEP", ",\n");
|
||||
code_ += " {{KEY}} = {{VALUE}},";
|
||||
|
||||
minv = !minv || minv->value > ev.value ? &ev : minv;
|
||||
maxv = !maxv || maxv->value < ev.value ? &ev : maxv;
|
||||
|
||||
@@ -169,7 +169,8 @@ pub mod example {
|
||||
pub enum Color {
|
||||
Red = 1,
|
||||
Green = 2,
|
||||
Blue = 8
|
||||
Blue = 8,
|
||||
|
||||
}
|
||||
|
||||
const ENUM_MIN_COLOR: i8 = 1;
|
||||
@@ -237,7 +238,8 @@ pub enum Any {
|
||||
NONE = 0,
|
||||
Monster = 1,
|
||||
TestSimpleTableWithEnum = 2,
|
||||
MyGame_Example2_Monster = 3
|
||||
MyGame_Example2_Monster = 3,
|
||||
|
||||
}
|
||||
|
||||
const ENUM_MIN_ANY: u8 = 0;
|
||||
|
||||
@@ -30,7 +30,8 @@ pub mod namespace_b {
|
||||
pub enum EnumInNestedNS {
|
||||
A = 0,
|
||||
B = 1,
|
||||
C = 2
|
||||
C = 2,
|
||||
|
||||
}
|
||||
|
||||
const ENUM_MIN_ENUM_IN_NESTED_N_S: i8 = 0;
|
||||
|
||||
Reference in New Issue
Block a user