Skip to content

Commit ca234a3

Browse files
authored
Implement Copy and Clone for Handle<T> where T: !Copy (#563)
Signed-off-by: Greg Morenz <[email protected]>
1 parent 2c59822 commit ca234a3

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

mozjs/src/gc/root.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,18 @@ impl<'a, const N: usize> From<&RootedGuard<'a, ValueArray<N>>> for JS::HandleVal
9595
}
9696
}
9797

98-
#[derive(Clone, Copy)]
9998
pub struct Handle<'a, T: 'a> {
10099
pub(crate) ptr: &'a T,
101100
}
102101

102+
impl<T> Clone for Handle<'_, T> {
103+
fn clone(&self) -> Self {
104+
*self
105+
}
106+
}
107+
108+
impl<T> Copy for Handle<'_, T> {}
109+
103110
#[derive(Copy, Clone)]
104111
pub struct MutableHandle<'a, T: 'a> {
105112
pub(crate) ptr: *mut T,

0 commit comments

Comments
 (0)