Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
flatbuffers
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
flatbuffers
Commits
cb7b2bf8
Commit
cb7b2bf8
authored
Mar 06, 2019
by
jean-airoldie
Committed by
Robert
Mar 06, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Rust] Fixed codegen documentation for Tables (#5227)
parent
bfa43030
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
idl_gen_rust.cpp
src/idl_gen_rust.cpp
+3
-2
monster_test_generated.rs
tests/monster_test_generated.rs
+1
-1
No files found.
src/idl_gen_rust.cpp
View file @
cb7b2bf8
...
@@ -1150,8 +1150,6 @@ class RustGenerator : public BaseGenerator {
...
@@ -1150,8 +1150,6 @@ class RustGenerator : public BaseGenerator {
// Generate an accessor struct, builder struct, and create function for a
// Generate an accessor struct, builder struct, and create function for a
// table.
// table.
void
GenTable
(
const
StructDef
&
struct_def
)
{
void
GenTable
(
const
StructDef
&
struct_def
)
{
GenComment
(
struct_def
.
doc_comment
);
code_
.
SetValue
(
"STRUCT_NAME"
,
Name
(
struct_def
));
code_
.
SetValue
(
"STRUCT_NAME"
,
Name
(
struct_def
));
code_
.
SetValue
(
"OFFSET_TYPELABEL"
,
Name
(
struct_def
)
+
"Offset"
);
code_
.
SetValue
(
"OFFSET_TYPELABEL"
,
Name
(
struct_def
)
+
"Offset"
);
code_
.
SetValue
(
"STRUCT_NAME_SNAKECASE"
,
MakeSnakeCase
(
Name
(
struct_def
)));
code_
.
SetValue
(
"STRUCT_NAME_SNAKECASE"
,
MakeSnakeCase
(
Name
(
struct_def
)));
...
@@ -1161,6 +1159,9 @@ class RustGenerator : public BaseGenerator {
...
@@ -1161,6 +1159,9 @@ class RustGenerator : public BaseGenerator {
code_
+=
"pub enum {{OFFSET_TYPELABEL}} {}"
;
code_
+=
"pub enum {{OFFSET_TYPELABEL}} {}"
;
code_
+=
"#[derive(Copy, Clone, Debug, PartialEq)]"
;
code_
+=
"#[derive(Copy, Clone, Debug, PartialEq)]"
;
code_
+=
""
;
code_
+=
""
;
GenComment
(
struct_def
.
doc_comment
);
code_
+=
"pub struct {{STRUCT_NAME}}<'a> {"
;
code_
+=
"pub struct {{STRUCT_NAME}}<'a> {"
;
code_
+=
" pub _tab: flatbuffers::Table<'a>,"
;
code_
+=
" pub _tab: flatbuffers::Table<'a>,"
;
code_
+=
"}"
;
code_
+=
"}"
;
...
...
tests/monster_test_generated.rs
View file @
cb7b2bf8
...
@@ -920,10 +920,10 @@ impl<'a: 'b, 'b> ReferrableBuilder<'a, 'b> {
...
@@ -920,10 +920,10 @@ impl<'a: 'b, 'b> ReferrableBuilder<'a, 'b> {
}
}
}
}
/// an example documentation comment: monster object
pub
enum
MonsterOffset
{}
pub
enum
MonsterOffset
{}
#[derive(Copy,
Clone,
Debug,
PartialEq)]
#[derive(Copy,
Clone,
Debug,
PartialEq)]
/// an example documentation comment: monster object
pub
struct
Monster
<
'a
>
{
pub
struct
Monster
<
'a
>
{
pub
_tab
:
flatbuffers
::
Table
<
'a
>
,
pub
_tab
:
flatbuffers
::
Table
<
'a
>
,
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment