Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jam1garner/cpp-inherit
A macro for inheriting Rust structures from C++ classes. Nothing valued is here.
https://github.com/jam1garner/cpp-inherit
Last synced: 4 days ago
JSON representation
A macro for inheriting Rust structures from C++ classes. Nothing valued is here.
- Host: GitHub
- URL: https://github.com/jam1garner/cpp-inherit
- Owner: jam1garner
- Created: 2020-07-24T02:05:18.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-12-04T09:32:01.000Z (about 1 year ago)
- Last Synced: 2025-01-03T02:53:58.737Z (5 days ago)
- Language: Rust
- Homepage:
- Size: 23.4 KB
- Stars: 35
- Watchers: 4
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# cpp-inherit
A macro for inheriting Rust structures from C++ classes. Nothing of value lies here.### Example
```rust
use cpp_inherit::*;#[inherit_from(BaseType)]
#[derive(Debug)]
struct RustType {}#[inherit_from_impl(BaseType, "test.hpp")]
impl RustType {
fn new() -> Self {
Self {
_base: BaseType { vtable_: RustType::VTABLE_ as _, value: 3 }
}
}#[overridden] fn x(&self) -> i32 {
99
}
}// Now you can pass RustType as a BaseType, access any BaseType fields, call any BaseType methods (virtual or not), from either C++ or Rust
```[Rest of example usage here](https://github.com/jam1garner/cpp-inherit-test)