Trait magnus::rb_sys::FromRawValue
source · Available on crate feature
rb-sys-interop
only.Required Methods
sourceunsafe fn from_raw(value: VALUE) -> Self
unsafe fn from_raw(value: VALUE) -> Self
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");