PhoenixGenerator  3.4.0
Generate code from template files and projects in C++, Rust, Python and wrapped C++ to Python
Loading...
Searching...
No Matches
generator_class_rust.h File Reference
Include dependency graph for generator_class_rust.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool generator_rust_class_full (const PRustTraitBackendManager &manager, const ProjectParam &projectParam)
 Generate the full Rust sources (and related integration tests) from configuration.

Function Documentation

◆ generator_rust_class_full()

bool generator_rust_class_full ( const PRustTraitBackendManager & manager,
const ProjectParam & projectParam )

Generate the full Rust sources (and related integration tests) from configuration.

Parameters
manager: PRustTraitBackendManager which handles all trait backend
projectParam: description of classes and how and where to generate sources and test
Returns
true on success, false otherwise

Definition at line 163 of file generator_class_rust.cpp.

163 {
164 bool b(true);
165 b &= projectParam.outputSourceDir.createDirectory();
166 if(projectParam.mode.enableUnitTest){
167 b &= projectParam.outputTestDir.createDirectory();
168 }
169 for(const PDataConfig & config : projectParam.vecDataConfig){
170 PPath baseFileName = config.getFileName().getFileName().eraseExtension();
171 b &= generator_rust_class(manager, config.getVecClassConfig(), projectParam.outputSourceDir, baseFileName, projectParam.mode);
172 if(projectParam.mode.enableUnitTest){
173 b &= generator_rust_class_test(manager, projectParam.outputTestDir, projectParam.mode.moduleName, baseFileName, config.getVecClassConfig(), projectParam.mode);
174 }
175 }
176 return b;
177}
Class to describe a basic class.
Definition PDataConfig.h:17
const PVecClassConfig & getVecClassConfig() const
Get the vector of all config class of the current pdata file.
const PPath & getFileName() const
Get the file name of the current PDataConfig.
bool generator_rust_class(const PRustTraitBackendManager &manager, const std::vector< PClassConfig > &vecClassConfig, const PPath &outputSourceDir, const PPath &baseFileName, const GeneratorMode &mode)
Write the Rust module (one file per pdata file) containing every struct/enum it defines.
bool generator_rust_class_test(const PRustTraitBackendManager &manager, const PPath &outputTestDir, const PString &crateName, const PPath &baseFileName, const std::vector< PClassConfig > &vecClassConfig, const GeneratorMode &mode)
Write the Rust integration test file (one file per pdata file) exercising every non-enum class it def...
PString moduleName
Name of the wrapper python module.
bool enableUnitTest
True to enable the unit tests.
GeneratorMode mode
Mode to be used to generate the project.
PPath outputTestDir
Output path of the unit tests.
PVecDataConfig vecDataConfig
Configuration of classes to be generated.
PPath outputSourceDir
Output path of the sources.

References GeneratorMode::enableUnitTest, generator_rust_class(), generator_rust_class_full(), generator_rust_class_test(), PDataConfig::getFileName(), PDataConfig::getVecClassConfig(), ProjectParam::mode, GeneratorMode::moduleName, ProjectParam::outputSourceDir, ProjectParam::outputTestDir, and ProjectParam::vecDataConfig.

Referenced by generateRustClassesFull(), and generator_rust_class_full().

Here is the call graph for this function:
Here is the caller graph for this function: