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 UniquePtrs.
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.
Trait Implementations§
Source§impl Parse for IncludeCppEngine
impl Parse for IncludeCppEngine
fn parse(input: ParseStream<'_>) -> ParseResult<Self>
Auto Trait Implementations§
impl Freeze for IncludeCppEngine
impl RefUnwindSafe for IncludeCppEngine
impl !Send for IncludeCppEngine
impl !Sync for IncludeCppEngine
impl Unpin for IncludeCppEngine
impl UnsafeUnpin for IncludeCppEngine
impl UnwindSafe for IncludeCppEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more