Trait magnus::rb_sys::FromRawValue
source · pub trait FromRawValue {
// Required method
unsafe fn from_raw(value: VALUE) -> Self;
}
Available on crate feature
rb-sys
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::{rb_sys::FromRawValue, Value};
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");
Object Safety§
This trait is not object safe.