summaryrefslogtreecommitdiff
path: root/src/idl_gen_rust.cpp
diff options
context:
space:
mode:
authormustiikhalil <mustii@mmk.one>2020-10-07 19:56:30 +0300
committerGitHub <noreply@github.com>2020-10-07 09:56:30 -0700
commit7b9e61fccffbaf9a673ae51f89c490508fd39670 (patch)
treee3a985a85a0cb8e10f06b026bc0d52d1f4dd1fa8 /src/idl_gen_rust.cpp
parent3359e3042fd1dd947c4093b90ecce24d1839fbdd (diff)
downloadflatbuffers-7b9e61fccffbaf9a673ae51f89c490508fd39670.tar.gz
flatbuffers-7b9e61fccffbaf9a673ae51f89c490508fd39670.tar.bz2
flatbuffers-7b9e61fccffbaf9a673ae51f89c490508fd39670.zip
[TS] GRPC Implementation (#6141)
* GRPC implementation for Typescript * Fixes a couple of issues * Finished implementing the typescript support for grpc * Updated generated code * Fixes CI
Diffstat (limited to 'src/idl_gen_rust.cpp')
-rw-r--r--src/idl_gen_rust.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/idl_gen_rust.cpp b/src/idl_gen_rust.cpp
index 1e7502ae..16c8dfa1 100644
--- a/src/idl_gen_rust.cpp
+++ b/src/idl_gen_rust.cpp
@@ -47,9 +47,7 @@ std::string MakeSnakeCase(const std::string &in) {
// Convert a string to all uppercase.
std::string MakeUpper(const std::string &in) {
std::string s;
- for (size_t i = 0; i < in.length(); i++) {
- s += CharToUpper(in[i]);
- }
+ for (size_t i = 0; i < in.length(); i++) { s += CharToUpper(in[i]); }
return s;
}
@@ -668,8 +666,8 @@ class RustGenerator : public BaseGenerator {
return field.optional ? "None" : field.value.constant;
}
case ftBool: {
- return field.optional ? "None" :
- field.value.constant == "0" ? "false" : "true";
+ return field.optional ? "None"
+ : field.value.constant == "0" ? "false" : "true";
}
case ftUnionKey:
case ftEnumKey: {
@@ -868,9 +866,9 @@ class RustGenerator : public BaseGenerator {
case ftBool:
case ftFloat: {
const auto typname = GetTypeBasic(field.value.type);
- return (field.optional ?
- "self.fbb_.push_slot_always::<" :
- "self.fbb_.push_slot::<") + typname + ">";
+ return (field.optional ? "self.fbb_.push_slot_always::<"
+ : "self.fbb_.push_slot::<") +
+ typname + ">";
}
case ftEnumKey:
case ftUnionKey: {
@@ -1005,7 +1003,7 @@ class RustGenerator : public BaseGenerator {
const auto default_value = GetDefaultScalarValue(field);
return "self._tab.get::<" + typname + ">(" + offset_name + ", Some(" +
default_value + ")).unwrap()";
- }
+ }
}
case ftStruct: {
const auto typname = WrapInNameSpace(*type.struct_def);