#[thx]Expand description
#[thx] — splice my_perl: *mut ::libperl_sys::PerlInterpreter as the
first parameter of fn in threaded builds; pass through unchanged in
non-threaded builds.
The injected name my_perl matches the C convention (aTHX_) and the
project’s naming rule (see docs/plan/README.md §3.8). The
fully-qualified path ::libperl_sys::PerlInterpreter is hard-coded
rather than $crate::PerlInterpreter because proc-macros emit raw
tokens — the path is resolved at the call site of #[thx].
§Examples
Source:
ⓘ
#[thx]
fn helper(sv: *mut SV) -> i32 { /* ... */ }Threaded expansion:
ⓘ
fn helper(my_perl: *mut ::libperl_sys::PerlInterpreter, sv: *mut SV) -> i32 { /* ... */ }Non-threaded expansion: identical to the input.