Implement Clone for Copy types.

This commit is contained in:
Ms2ger 2015-04-28 19:42:46 +02:00
parent b6fc83cf2b
commit 903305416a
53 changed files with 105 additions and 105 deletions

View file

@ -16,7 +16,7 @@ use std::ffi::CString;
use std::ptr;
/// The exception handling used for a call.
#[derive(Copy, PartialEq)]
#[derive(Copy, Clone, PartialEq)]
pub enum ExceptionHandling {
/// Report any exception and don't throw it to the caller code.
Report,

View file

@ -2917,7 +2917,7 @@ class CGEnum(CGThing):
decl = """\
#[repr(usize)]
#[derive(PartialEq, Copy)]
#[derive(PartialEq, Copy, Clone)]
#[jstraceable]
pub enum %s {
%s
@ -5388,8 +5388,8 @@ class GlobalGenRoots():
return CGList([
CGGeneric(AUTOGENERATED_WARNING_COMMENT),
CGGeneric("pub const MAX_PROTO_CHAIN_LENGTH: usize = %d;\n\n" % config.maxProtoChainLength),
CGNonNamespacedEnum('ID', protos, [0], deriving="PartialEq, Copy"),
CGNonNamespacedEnum('Proxies', proxies, [0], deriving="PartialEq, Copy"),
CGNonNamespacedEnum('ID', protos, [0], deriving="PartialEq, Copy, Clone"),
CGNonNamespacedEnum('Proxies', proxies, [0], deriving="PartialEq, Copy, Clone"),
])

View file

@ -25,7 +25,7 @@ use js::jsapi::{JS_GetClass};
use url::Url;
/// A freely-copyable reference to a rooted global object.
#[derive(Copy)]
#[derive(Copy, Clone)]
pub enum GlobalRef<'a> {
/// A reference to a `Window` object.
Window(JSRef<'a, window::Window>),

View file

@ -124,6 +124,9 @@ impl<T: Reflectable> Rootable<T> for Unrooted<T> {
}
impl<T> Copy for Unrooted<T> {}
impl<T> Clone for Unrooted<T> {
fn clone(&self) -> Unrooted<T> { *self }
}
/// A type that represents a JS-owned value that is rooted for the lifetime of
/// this value. Importantly, it requires explicit rooting in order to interact
@ -545,6 +548,9 @@ pub struct RootCollection {
pub struct RootCollectionPtr(pub *const RootCollection);
impl Copy for RootCollectionPtr {}
impl Clone for RootCollectionPtr {
fn clone(&self) -> RootCollectionPtr { *self }
}
impl RootCollection {
/// Create an empty collection of roots

View file

@ -129,7 +129,7 @@ pub struct NativePropertyHooks {
}
/// The struct that holds inheritance information for DOM object reflectors.
#[derive(Copy)]
#[derive(Copy, Clone)]
pub struct DOMClass {
/// A list of interfaces that this object implements, in order of decreasing
/// derivedness.
@ -148,6 +148,9 @@ pub struct DOMJSClass {
/// Associated data for DOM object reflectors.
pub dom_class: DOMClass
}
impl Clone for DOMJSClass {
fn clone(&self) -> DOMJSClass { *self }
}
unsafe impl Sync for DOMJSClass {}
/// Returns the ProtoOrIfaceArray for the given global object.