Struct autocxx_engine::IncludeCppEngine
source · pub struct IncludeCppEngine { /* private fields */ }
Expand description
Core of the autocxx engine.
The basic idea is this. We will run bindgen
which will spit
out a ton of Rust code corresponding to all the types and functions
defined in C++. We’ll then post-process that bindgen output
into a form suitable for ingestion by cxx
.
(It’s the BridgeConverter
mod which does that.)
Along the way, the bridge_converter
might tell us of additional
C++ code which we should generate, e.g. wrappers to move things
into and out of UniquePtr
s.
Here’s a zoomed-in view of the “conversion” part:
Implementations§
source§impl IncludeCppEngine
impl IncludeCppEngine
pub fn new_from_syn(mac: Macro, file_contents: Rc<String>) -> Result<Self>
sourcepub fn new_for_autodiscover() -> Self
pub fn new_for_autodiscover() -> Self
Used if we find that we’re asked to auto-discover extern_rust_type and similar but didn’t have any include_cpp macro at all.
pub fn config_mut(&mut self) -> &mut IncludeCppConfig
pub fn get_rs_filename(&self) -> String
sourcepub fn get_rs_output(&self) -> RsOutput<'_>
pub fn get_rs_output(&self) -> RsOutput<'_>
Generate the Rust bindings. Call generate
first.
sourcepub fn get_mod_name(&self) -> String
pub fn get_mod_name(&self) -> String
Returns the name of the mod which this include_cpp!
will generate.
Can and should be used to ensure multiple mods in a file don’t conflict.
sourcepub fn generate(
&mut self,
inc_dirs: Vec<PathBuf>,
extra_clang_args: &[&str],
dep_recorder: Option<Box<dyn RebuildDependencyRecorder>>,
codegen_options: &CodegenOptions<'_>
) -> Result<()>
pub fn generate( &mut self, inc_dirs: Vec<PathBuf>, extra_clang_args: &[&str], dep_recorder: Option<Box<dyn RebuildDependencyRecorder>>, codegen_options: &CodegenOptions<'_> ) -> Result<()>
Actually examine the headers to find out what needs generating. Most errors occur at this stage as we fail to interpret the C++ headers properly.
See documentation for this type for flow diagrams and more details.