Function magnus::gc::enable

source ·
pub fn enable() -> bool
Expand description

Enable automatic GC run.

Garbage Collection is enabled by default, calling this function only makes sense if disable was previously called.

Returns true if GC was previously disabled, false otherwise.

§Panics

Panics if called from a non-Ruby thread. See Ruby::gc_enable for the non-panicking version.

§Examples

use magnus::gc;

let was_disabled = gc::enable();

// GC is on

// return GC to previous state
if was_disabled {
    gc::disable();
}