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]
fn new() -> Config
Creates an empty Config.
fn add_linked_lib<P: Into<String>>(&mut self, lib: P)
Adds a library for linking. Used as -l option to the linker.
fn add_linked_framework<P: Into<String>>(&mut self, lib: P)
Adds a framework for linking (OS X specific). Used as -f option to the linker.
fn add_cpp_parser_blocked_name<P: Into<String>>(&mut self, lib: P)
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.
fn add_cpp_parser_blocked_names<Item, Iter>(&mut self, items: Iter) where
Item: Into<String>,
Iter: IntoIterator<Item = Item>,
Item: Into<String>,
Iter: IntoIterator<Item = Item>,
Adds multiple blocked names. See Config::add_cpp_parser_blocked_name.
fn add_cpp_parser_flag<P: Into<String>>(&mut self, lib: P)
Adds a command line argument for clang C++ parser.
fn add_cpp_parser_flags<Item, Iter>(&mut self, items: Iter) where
Item: Into<String>,
Iter: IntoIterator<Item = Item>,
Item: Into<String>,
Iter: IntoIterator<Item = Item>,
Adds multiple flags. See Config::add_cpp_parser_flag.
fn add_cpp_compiler_flag<P: Into<String>>(&mut self, lib: P)
Adds a command line argument for the C++ compiler.
fn add_cpp_compiler_flags<Item, Iter>(&mut self, items: Iter) where
Item: Into<String>,
Iter: IntoIterator<Item = Item>,
Item: Into<String>,
Iter: IntoIterator<Item = Item>,
Adds multiple flags. See Config::add_cpp_compiler_flag.
fn add_include_path<P: Into<PathBuf>>(&mut self, path: P)
Adds path to an include directory.
It's supplied to the C++ parser
and the C++ compiler via -I option.
fn add_lib_path<P: Into<PathBuf>>(&mut self, path: P)
Adds path to a lib directory.
It's supplied to the linker via -L option or environment variables.
fn add_framework_path<P: Into<PathBuf>>(&mut self, path: P)
Adds path to a framework directory (OS X specific).
It's supplied to the linker via -F option or environment variables.
fn add_target_include_path<P: Into<PathBuf>>(&mut self, path: P)
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.
fn add_include_directive<P: Into<PathBuf>>(&mut self, path: P)
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.
fn add_cpp_ffi_generator_filter(&mut self, f: Box<CppFfiGeneratorFilterFn>)
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:
Errindicates an unexpected failure and terminates the processing.Ok(true)allows to continue processing of the method. If all functions returnOk(true), the method is accepted.Ok(false)blocks the method. Remaining filter functions are not run on this method.
fn add_cpp_data_filter(&mut self, f: Box<CppDataFilterFn>)
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.
fn exec(self) -> Result<()>
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); }