logo
pub struct UnboxedValueGuard<'a, T> { /* private fields */ }

Implementations

Construct a new guard around the given T.

UnboxedValueGuard allows passing around a &mut reference without dropping the T when returning control to mruby C code. This is desirable because the T is owned by the mruby heap until the mruby garbage collector frees the mrb_value that holds it.

Get a shared reference to the inner T.

Get a unique reference to the inner T.

Safety

Callers must ensure the raw parts stored in the source mrb_value are not invalidated OR that the raw parts are repacked before an mruby allocation occurs.

Take the inner T out of the guard.

Safety

Callers must ensure that T is not dropped. Once T is taken out of the guard, it must ultimately be passed to ManuallyDrop before it is dropped.

An example of safe usage is calling taking an Array out of the guard and then immediately calling Array::into_raw_parts on the returned value.

Trait Implementations

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

The resulting type after dereferencing.

Dereferences the value.

The resulting type after dereferencing.

Dereferences the value.

The resulting type after dereferencing.

Dereferences the value.

Mutably dereferences the value.

Mutably dereferences the value.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.