diff options
author | Mat Sadler <mat@sourcetagsandcodes.com> | 2023-07-28 21:19:04 -0700 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-07-31 06:25:21 +0000 |
commit | a3c0e9d90d657d9b288fb4a50462684087f4162f (patch) | |
tree | 441ede767a35d0e47fdd77f834814aa499144ec2 /lib/bundler/templates | |
parent | 36023d5cb751d62fca0c27901c07527b20170f4d (diff) |
[rubygems/rubygems] update Magnus library in Rust extension gem template
https://github.com/rubygems/rubygems/commit/19a92a3367
Diffstat (limited to 'lib/bundler/templates')
-rw-r--r-- | lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt | 2 | ||||
-rw-r--r-- | lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt b/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt index 4b6e9587f7..c64385486e 100644 --- a/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +++ b/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt @@ -12,4 +12,4 @@ publish = false crate-type = ["cdylib"] [dependencies] -magnus = { version = "0.4" } +magnus = { version = "0.6" } diff --git a/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt b/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt index b311283997..ba234529a3 100644 --- a/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt +++ b/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt @@ -1,12 +1,12 @@ -use magnus::{define_module, function, prelude::*, Error}; +use magnus::{function, prelude::*, Error, Ruby}; fn hello(subject: String) -> String { - format!("Hello from Rust, {}!", subject) + format!("Hello from Rust, {subject}!") } #[magnus::init] -fn init() -> Result<(), Error> { - let module = <%= config[:constant_array].map {|c| "define_module(#{c.dump})?"}.join(".") %>; +fn init(ruby: &Ruby) -> Result<(), Error> { + let module = ruby.<%= config[:constant_array].map {|c| "define_module(#{c.dump})?"}.join(".") %>; module.define_singleton_method("hello", function!(hello, 1))?; Ok(()) } |