Crate magnus_macros

Source
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 required by Ruby code.
wrap
Allow a Rust type to be passed to Ruby, automatically wrapped as a Ruby object.

Derive Macros§

DataTypeFunctions
Derives DataTypeFunctions with default implementations, for simple uses of TypedData.
TypedData
Derives TypedData, allowing the type to be passed to Ruby automatically wrapped as a Ruby object.