Struct ritual::config::Config

source ·
pub struct Config { /* private fields */ }
Expand description

The starting point of cpp_to_rust API. Create a Config object, set its properties, add custom functions if necessary, and start the processing with Config::exec.

Implementations

Creates a Config. crate_properties are used in Cargo.toml of the generated crate.

Sets the directory containing additional files for the crate. Any files and directories found in the crate template will be copied to the generated crate’s directory, although some of them (such as Cargo.toml) may be overwritten with the generates files. It’s common to put tests and examples subdirectories in the crate template so that cargo recognizes them automatically in the generated crate.

If you want to add some extra code to the generated modules, put src/module_name.rs file in the crate template and add include_generated!(); line in the file. This line will be replaced with the generated content. You can also add extra modules as separate files, but you’ll also need to create src/lib.rs in the crate template and declare new module in it using [pub] mod module_name;. Use include_generated!(); in src/lib.rs to include declaration of automatically generated modules.

If the crate template contains rustfmt.toml file, it’s used to format the generated Rust code instead of the default rustfmt.toml.

Creating crate template is optional. The generator can make a crate without a template.

Sets list of names of crates created with cpp_to_rust. The generator will integrate API of the current library with its dependencies and re-use their types.

Adds a C++ identifier that should be skipped by the C++ parser. Identifier can contain namespaces and nested classes, with :: separator (like in C++ identifiers). Identifier may refer to a method, a class, a enum or a namespace. All entities inside blacklisted entity (e.g. the methods of a blocked class or the contents of a blocked namespace) will also be skipped. All class methods with names matching the blocked name will be skipped, regardless of class name.

Adds multiple blocked names. See Config::add_cpp_parser_blocked_name.

Adds a command line argument for clang C++ parser.

Note that this value is not used when building the wrapper library. Use Config::cpp_build_config_mut or a similar method to configure building the wrapper library.

Adds multiple command line arguments for clang C++ parser. See Config::add_cpp_parser_argument.

Sets CppBuildPaths value for this config. These paths are used for testing C++ methods while processing the library, but they are not used when building the generated crate.

Adds path to an include directory or an include file of the target library. Any C++ types and methods will be parsed and used only if they are declared within one of files or directories added with this method.

If no target include paths are added, all types and methods will be used. Most libraries include system headers and other libraries’ header files, so this mode is often unwanted.

Adds an include directive. Each directive will be added as #include <path> to the input file for the C++ parser. File name only paths or relative paths should be used in this method.

Adds a namespace to filter out before rust code generation.

Adds multiple namespaces to filter out before rust code generation.

Overrides automatic selection of type allocation place for type_name and uses place instead. See CppTypeAllocationPlace for more information.

Sets CppBuildConfig value that will be passed to the build script of the generated crate.

Allows to change CppBuildConfig value that will be passed to the build script of the generated crate.

Returns crate properties passed to Config::new.

Returns value set by Config::set_crate_template_path.

Returns value set by Config::set_dependent_cpp_crates.

Returns names added with Config::add_cpp_parser_blocked_name and similar methods.

Returns names added with Config::add_cpp_parser_argument and similar methods.

Returns values added by Config::set_cpp_build_paths.

Returns values added by Config::add_target_include_path.

Returns values added by Config::add_include_directive.

Returns values added by Config::add_cpp_filtered_namespace.

Returns current CppBuildConfig value.

Returns values added by Config::set_movable_types. Keys of the hash map are names of C++ types.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.