libperl-macros
Procedural macros for libperl-rs. Lets you write a Perl XS
extension module in pure Rust:
use ;
xs_boot!
cargo build produces a .so that Perl can XSLoader::load.
What's exported
#[thx]— function attribute that splicesmy_perl: *mut PerlInterpreteras the first parameter in threaded builds and is a no-op in non-threaded builds. One source compiles in bothMULTIPLICITYmodes.#[xs_sub]— turns a high-level Rust signature likefn foo(my_perl: &Perl, av: &Av) -> IV { ... }into a completeextern "C"XS-callable trampoline. Supports IV / UV / NV / bool / String /&CStr/&str/*mut SV/Sv/&Av/&Hv/Vec<T>/Result<T, String>/Option<T>/Rv<Av>/Rv<Hv>. Performs runtime type checks (SvROK+SvTYPE) on reference args and croaks with a human-readable message on mismatch.xs_boot!— declarative macro that emits the module'sboot_<package>symbol, which Perl's loader calls to register the XS subs.
Status
Pre-1.0. Tracks libperl-rs 0.4.0-alpha. See the workspace README in
the main repository for the larger picture.
License
GPL-1.0-or-later OR Artistic-1.0-Perl.