pub unsafe fn init() -> Cleanup
Available on crate feature
embed
only.Expand description
Initialises the Ruby VM.
Calling this function is only required when embedding Ruby in Rust. It is not required when embedding Rust in Ruby, e.g. in a Ruby Gem.
Safety
Must be called in main()
, or at least a function higher up the stack than
any code calling Ruby. Must not drop Cleanup until the very end of the
process, after all Ruby execution has finished.
Panics
Panics if called more than once.
Examples
let _cleanup = unsafe { magnus::embed::init() };