Skip to content

Commit 1658f77

Browse files
committed
Add a new JS::MutableHandle::as_mut method
Signed-off-by: Greg Morenz <[email protected]>
1 parent fc86664 commit 1658f77

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

mozjs-sys/src/jsimpls.rs

+7
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,13 @@ impl<T> JS::MutableHandle<T> {
112112
{
113113
unsafe { *self.ptr = v }
114114
}
115+
116+
/// The returned pointer is aliased by a pointer that the GC will read
117+
/// through, and thus `&mut` references created from it must not be held
118+
/// across GC pauses.
119+
pub fn as_ptr(self) -> *mut T {
120+
self.ptr
121+
}
115122
}
116123

117124
impl JS::HandleValue {

0 commit comments

Comments
 (0)