Function magnus::gc::location

source ·
pub fn location<T>(value: T) -> Twhere
    T: ReprValue,
Available on ruby_gte_2_7 only.
Expand description

Get the new location of an object.

The Value type is effectly a pointer to a Ruby object. Ruby’s garbage collector will avoid moving objects exposed to extensions, unless the object has been marked with mark_movable. When implementing DataTypeFunctions::compact you will need to update any Ruby objects you are storing.

Returns a new Value that is pointing to the object that value used to point to. If value hasn’t moved, simply returns value.