script_bindings::import::base

Type Alias MutableHandleValue

Source
pub(crate) type MutableHandleValue<'a> = MutableHandle<'a, Value>;

Aliased Type§

struct MutableHandleValue<'a> { /* private fields */ }

Implementations

Source§

impl<'a, T> MutableHandle<'a, T>

Source

pub unsafe fn from_marked_location(ptr: *mut T) -> MutableHandle<'a, T>

Source

pub unsafe fn from_raw(handle: MutableHandle<T>) -> MutableHandle<'a, T>

Source

pub fn handle(&self) -> Handle<'_, T>

Source

pub fn get(&self) -> T
where T: Copy,

Source

pub fn set(&mut self, v: T)
where T: Copy,

Source

pub unsafe fn as_mut<'b>(&'b mut self) -> &'b mut T
where 'a: 'b,

Safety: GC must not run during the lifetime of the returned reference.

Source

pub fn reborrow<'b>(&'b mut self) -> MutableHandle<'b, T>
where 'a: 'b,

Creates a copy of this object, with a shorter lifetime, that holds a mutable borrow on the original object. When you write code that wants to use a MutableHandle more than once, you will typically need to call reborrow on all but the last usage. The same way that you might naively clone a type to allow it to be passed to multiple functions.

This is the same thing that happens with regular mutable references, except there the compiler implicitly inserts the reborrow calls. Until rust gains a feature to implicitly reborrow other types, we have to do it by hand.

Trait Implementations

Source§

impl<'a, T> Deref for MutableHandle<'a, T>

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &T

Dereferences the value.
Source§

impl<'a, T> IntoHandle for MutableHandle<'a, T>

Source§

type Target = T

The type of the handle
Source§

fn into_handle(self) -> Handle<T>

Convert this object to a handle.
Source§

impl<'a, T> IntoMutableHandle for MutableHandle<'a, T>

Source§

fn into_handle_mut(self) -> MutableHandle<T>

Convert this object to a mutable handle.