-
Notifications
You must be signed in to change notification settings - Fork 165
Open
Description
Expected Behavior
I should be able to replace a C++ type autocxx doesn't understand with my custom Rust type, and tell autocxx that it's a POD so it can be used in generate_pod! for other types like this:
#include <Eigen/Dense>
struct MyStruct {
Eigen::Vector2d vec;
};(Eigen is a header-only library, so should be relatively easy to add for a repro, but I suppose this can be reproduced with simpler custom types too)
#[repr(transparent)]
pub struct Vector2d(pub nalgebra::Vector2<f64>);
impl cxx::ExternType for Vector2d {
type Id = cxx::type_id!("Eigen::Vector2d");
type Kind = cxx::kind::Trivial;
}
include_cpp! {
#include "test.h"
safety!(unsafe)
extern_cpp_type!("Eigen::Vector2d", crate::Vector2d)
pod!("Eigen::Vector2d")
generate_pod!("MyStruct")
}Actual Behavior
autocxx complains that MyStruct can't be generated as a POD because the dependency type "isn't known":
--- stderr
Error:
× the include_cpp! macro couldn't be expanded into Rust bindings to C++:
│ An item was requested using 'generate_pod' which was not safe to hold by
│ value in Rust. Type MyStruct could not be POD because its dependent type
│ Eigen::Vector2d isn't known
Specifications
- Version: 0.23.1
Metadata
Metadata
Assignees
Labels
No labels