cxx
cxx copied to clipboard
`cfg_attr` in bridge module
I have a project using cxx
to which I wished to add serde
support, but I would prefer it be an optional feature. Several of the types exposed by its API are shared types declared in the FFI bridge. Unfortunately, it seems that cfg_attr
is not currently supported within the bridge. Example:
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Debug, Default, Clone, Copy, PartialEq, PartialOrd)]
pub struct Vector2f {
pub x: f32,
pub y: f32,
}
Which receives simply an Unsupported attribute
error.
I have no idea how difficult or not it would be to accommodate this use case, but if not too complex I would find it quite helpful. Otherwise I may need to make some wrapper types or some other workaround.