vtables 0.1.0

Interact with C++ virtual method tables from Rust
Documentation
  • Coverage
  • 33.33%
    1 out of 3 items documented0 out of 3 items with examples
  • Size
  • Source code size: 37.51 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 100.81 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Homepage
  • not-wlan/vtables
    44 6 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • not-wlan

vtables

Interact with C++ virtual method tables from Rust

Usage

Clone both this and vtables_derive and add the following to your Cargo.toml:

[dependencies]
vtables = "0.1"
vtables_derive = "0.1"

You can then use methods from the virtual method table like this:

use vtables::VTable;
use vtables_derive::VTable;
use vtables_derive::has_vtable;
use vtables_derive::virtual_index;

#[has_vtable]
#[derive(VTable, Debug)]
pub struct EngineClient {
}

#[allow(non_snake_case)]
impl EngineClient {
    #[virtual_index(5)]
    pub fn GetScreenSize(&self, width: *mut i32, height: *mut i32) {}
    
    #[virtual_index(26)]
    pub fn IsInGame(&self) -> bool {}

    #[virtual_index(108)]
    pub fn ExecuteClientCmd(&self, command: *const c_char) {}

    #[virtual_index(113)]
    pub fn ClientCmd_Unrestricted(&self, command: *const c_char) {}
}

A field containing the virtual method table pointer will automatically be added to your structure. Support for multiple inheritance is untested.