rust-samp-codegen
Proc macros that generate the FFI boilerplate for
rust-samp plugins.
Not affiliated. Independent community fork of samp-rs. Not affiliated with, endorsed by, or connected to SA-MP, the open.mp (Open Multiplayer) project, or the upstream
samp-rsrepository. "SA-MP" and "open.mp" belong to their respective owners and are named only to describe compatibility.
Provides:
#[native(name = "Pawn_Name")]— turns a Rust method or associated function into a Pawn-callable native. Generates theextern "C"wrapper, argument parsing viaAmxCell, panic isolation, and the__samp_reg_*registration function. DetectsResult<T, E>vsTreturn types automatically.#[event(name = "OnPlayerConnect")]— turns a Rust method into an observer of a Pawn callback. Parses the callback arguments like#[native]and runs the handler when the gamemode's public executes. Register the handlers in theevents: [...]list below.initialize_plugin!(type: T, natives: [...], events: [...])— emits the SA-MP entry points (Load,Unload,AmxLoad,AmxUnload,Supports,ProcessTick) and the open.mpComponentEntryPoint, including the vtable definitions for both Itanium (Linux GCC) and MSVC ABIs. Thenativesandeventslists are both optional.#[derive(SampPlugin)]— generatesimpl SampPlugin for T {}with all defaults.
Re-exported by rust-samp; you do not need to depend on this crate
directly unless you are building tooling on top of the codegen.
[]
# Re-exported by `rust-samp`; depend on `rust-samp-codegen` only for
# tooling that targets the macros directly.
= { = "rust-samp-codegen", = "1" }