Struct cpp_to_rust::config::Config [] [src]

pub struct Config { /* fields omitted */ }

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.

Methods

impl Config
[src]

Creates an empty Config.

Adds a library for linking. Used as -l option to the linker.

Adds a framework for linking (OS X specific). Used as -f option to the linker.

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.

Adds multiple flags. See Config::add_cpp_parser_flag.

Adds a command line argument for the C++ compiler.

Adds multiple flags. See Config::add_cpp_compiler_flag.

Adds path to an include directory. It's supplied to the C++ parser and the C++ compiler via -I option.

Adds path to a lib directory. It's supplied to the linker via -L option or environment variables.

Adds path to a framework directory (OS X specific). It's supplied to the linker via -F option or environment variables.

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. Relative paths should be used in this method.

Adds a custom function that decides whether a C++ method should be added to the C++ wrapper library. For each C++ method, each function will be run once. Filters are executed in the same order they were added.

Interpetation of the function's output:

  • Err indicates an unexpected failure and terminates the processing.
  • Ok(true) allows to continue processing of the method. If all functions return Ok(true), the method is accepted.
  • Ok(false) blocks the method. Remaining filter functions are not run on this method.

Adds a custom function that visits &mut CppData and can perform any changes in the output of the C++ parser. Filters are executed in the same order they were added. If the function returns Err, the processing is terminated.

Starts execution of the generator. This function will print the necessary build script output to stdout. It also displays some debugging output that can be made visible by running cargo commands with -vv option.

The result of this function must be checked. The recommended way:

if let Err(err) = config.exec() {
  err.display_report();
  std::process::exit(1);
}

Trait Implementations

impl Default for Config
[src]

Returns the "default value" for a type. Read more

impl Debug for Config
[src]

Formats the value using the given formatter.