Skip to content

Commit d520cc2

Browse files
committed
chore: stabilize with_vftable macro.
tracking rust-lang/rust#124225
1 parent b530172 commit d520cc2

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

crates/libdecima/src/lib.rs

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![feature(once_cell_get_mut)]
2-
#![feature(macro_metavar_expr_concat)]
2+
// #![feature(macro_metavar_expr_concat)]
33
#![allow(static_mut_refs)]
44

55
#[doc(include = "../README.md")]
@@ -26,10 +26,29 @@ pub mod macros {
2626

2727
#[macro_export]
2828
macro_rules! with_vftable {
29-
($name:ident, $(fn $func:ident($($var:ident: $var_ty:ty),*)$(-> $func_r:ty)?),*, $(pub $field:ident: $field_ty:ty),*,) => {
29+
// todo: wait for macro_metavar_expr_concat to be stable [https://github.com/rust-lang/rust/issues/124225]
30+
// ($name:ident, $(fn $func:ident($($var:ident: $var_ty:ty),*)$(-> $func_r:ty)?),*, $(pub $field:ident: $field_ty:ty),*,) => {
31+
// #[derive(Debug)]
32+
// #[repr(C)]
33+
// pub struct ${concat($name, Vtbl)} {
34+
// $(
35+
// pub $func: extern "C" fn($($var: $var_ty,)*)$( -> $func_r)?,
36+
// )*
37+
// }
38+
//
39+
// #[derive(Debug)]
40+
// #[repr(C)]
41+
// pub struct $name {
42+
// pub vtbl: *const ${concat($name, Vtbl)},
43+
// $(
44+
// pub $field: $field_ty,
45+
// )*
46+
// }
47+
// };
48+
($name:ident, $vtbl:ident, $(fn $func:ident($($var:ident: $var_ty:ty),*)$(-> $func_r:ty)?),*, $(pub $field:ident: $field_ty:ty),*$(,)?) => {
3049
#[derive(Debug)]
3150
#[repr(C)]
32-
pub struct ${concat($name, Vtbl)} {
51+
pub struct $vtbl {
3352
$(
3453
pub $func: extern "C" fn($($var: $var_ty,)*)$( -> $func_r)?,
3554
)*
@@ -38,7 +57,7 @@ pub mod macros {
3857
#[derive(Debug)]
3958
#[repr(C)]
4059
pub struct $name {
41-
pub vtbl: *const ${concat($name, Vtbl)},
60+
pub vtbl: *const $vtbl,
4261
$(
4362
pub $field: $field_ty,
4463
)*

crates/libdecima/src/types/nixxes/log.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use windows::Win32::System::Threading::CRITICAL_SECTION;
55

66
with_vftable!(
77
NxLogImpl,
8+
NxLogImplVtbl,
89

910
fn fn_destructor(),
1011
fn fn_constructor(),

0 commit comments

Comments
 (0)