pub trait FromRawValue {
    unsafe fn from_raw(value: VALUE) -> Self;
}
Available on crate feature rb-sys-interop only.
Expand description

Converts from a raw VALUE to a Value.

Required Methods

Convert rb_sys::VALUE to magnus::Value.

Safety

You must only supply a valid VALUE obtained from rb-sys to this function. Using a invalid Value produced from this function will void all saftey guarantees provided by Magnus.


use magnus::{RString, Value, rb_sys::FromRawValue};

let raw_value = unsafe { rb_sys::rb_str_new("foo".as_ptr() as *mut _, 3) };

assert_eq!(unsafe { Value::from_raw(raw_value) }.to_string(), "foo");

Implementors