Expand description
Derive and proc macros for magnus.
#[magnus::wrap(class = "RbPoint", free_immediately, size)]
struct Point {
x: isize,
y: isize,
}
#[magnus::init]
fn init() -> Result<(), magnus::Error> {
magnus::define_class("RbPoint", magnus::class::object())?;
Ok(())
}
Attribute Macros§
- init
- Mark a function as the ‘init’ function to be run for a library when it is
require
d by Ruby code. - wrap
- Allow a Rust type to be passed to Ruby, automatically wrapped as a Ruby object.
Derive Macros§
- Data
Type Functions - Derives
DataTypeFunctions
with default implementations, for simple uses ofTypedData
. - Typed
Data - Derives
TypedData
, allowing the type to be passed to Ruby automatically wrapped as a Ruby object.