Sha256: ece71a3bfae51034021f99296547b836b63bdb6f95b9f97c19eb5778de37d45b
Contents?: true
Size: 544 Bytes
Versions: 1
Compression:
Stored size: 544 Bytes
Contents
use magnus::{define_module, function, prelude::*, Error}; use rb_allocator::ruby_global_allocator; use rb_sys::ruby_extension; // Ensure that the Ruby C ABI is being used. ruby_extension!(); // Inform Ruby's GC about memory allocations. ruby_global_allocator!(); fn hello(subject: String) -> String { format!("Hello from Rust, {}!", subject) } #[magnus::init] fn init() -> Result<(), Error> { let module = define_module("Svg")?.define_module("Hush")?; module.define_singleton_method("hello", function!(hello, 1))?; Ok(()) }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
svg-hush-0.1.0.pre.pre | ext/svg-hush/src/lib.rs |