macro_rules! rebind {
($($path:ident).*($($arg:expr),+)$($x:tt)?) => { ... };
($($path:ident).*($($arg:expr),+).unwrap()) => { ... };
($value:expr, $cx:expr) => { ... };
}
Expand description
Rebinds an object so that it is bound to an immutable borrow of crate::gc::Context
instead of a mutable borrow. This can release the mutable borrow and allow
Context to be used for other things.
§Examples
ⓘ
let object = rebind!(func1(&mut cx));
func2(&mut cx);
let object2 = object;
wthout this macro the above code would not compile because object
can’t
outlive the call to func2.