mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-03 12:21:23 +00:00
Implement a config based name manager and use it in Rust codegen (#7144)
* Refactor out a class from Rust Codegen * Convert GenerateRustModuleRootFile * git-clang-format * unused variable * parenthesis * update BUILD file * buildifier * Delete bfbs_gen_rust.h * Delete bfbs_gen_rust.cpp * Addressed some comments * Namer::EnumVariant * Remove do not submit; Add Namespace vector overload * Unshadow variable * removed redundant variables * Warn if converting from kKeep case. Co-authored-by: Casper Neo <cneo@google.com>
This commit is contained in:
@@ -416,6 +416,7 @@ static std::string ToDasher(const std::string &input) {
|
||||
|
||||
std::string ConvertCase(const std::string &input, Case output_case,
|
||||
Case input_case) {
|
||||
if (output_case == Case::kKeep) return input;
|
||||
// The output cases expect snake_case inputs, so if we don't have that input
|
||||
// format, try to convert to snake_case.
|
||||
switch (input_case) {
|
||||
@@ -423,6 +424,7 @@ std::string ConvertCase(const std::string &input, Case output_case,
|
||||
case Case::kUpperCamel:
|
||||
return ConvertCase(CamelToSnake(input), output_case);
|
||||
case Case::kDasher: return ConvertCase(DasherToSnake(input), output_case);
|
||||
case Case::kKeep: printf("WARNING: Converting from kKeep case.\n");
|
||||
default:
|
||||
case Case::kSnake:
|
||||
case Case::kScreamingSnake:
|
||||
|
||||
Reference in New Issue
Block a user