mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Implement Clone for Copy types.
This commit is contained in:
parent
b6fc83cf2b
commit
903305416a
53 changed files with 105 additions and 105 deletions
|
@ -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,
|
||||
|
|
|
@ -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"),
|
||||
])
|
||||
|
||||
|
||||
|
|
|
@ -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>),
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -13,7 +13,7 @@ use util::str::DOMString;
|
|||
use std::borrow::ToOwned;
|
||||
|
||||
#[repr(u16)]
|
||||
#[derive(Copy, Debug)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[jstraceable]
|
||||
pub enum DOMErrorName {
|
||||
IndexSizeError = DOMExceptionConstants::INDEX_SIZE_ERR,
|
||||
|
|
|
@ -108,7 +108,7 @@ impl ElementDerived for EventTarget {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, PartialEq, Debug)]
|
||||
#[derive(Copy, Clone, PartialEq, Debug)]
|
||||
#[jstraceable]
|
||||
pub enum ElementTypeId {
|
||||
HTMLElement(HTMLElementTypeId),
|
||||
|
|
|
@ -19,7 +19,7 @@ use std::default::Default;
|
|||
use time;
|
||||
|
||||
#[jstraceable]
|
||||
#[derive(Copy)]
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(u16)]
|
||||
pub enum EventPhase {
|
||||
None = EventConstants::NONE,
|
||||
|
|
|
@ -33,14 +33,14 @@ use url::Url;
|
|||
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[derive(Copy, PartialEq)]
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
#[jstraceable]
|
||||
pub enum ListenerPhase {
|
||||
Capturing,
|
||||
Bubbling,
|
||||
}
|
||||
|
||||
#[derive(Copy, PartialEq)]
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
#[jstraceable]
|
||||
pub enum EventTargetTypeId {
|
||||
Node(NodeTypeId),
|
||||
|
@ -51,7 +51,7 @@ pub enum EventTargetTypeId {
|
|||
XMLHttpRequestEventTarget(XMLHttpRequestEventTargetTypeId)
|
||||
}
|
||||
|
||||
#[derive(Copy, PartialEq)]
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
#[jstraceable]
|
||||
pub enum EventListenerType {
|
||||
Additive(EventListener),
|
||||
|
@ -67,7 +67,7 @@ impl EventListenerType {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, PartialEq)]
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
#[jstraceable]
|
||||
#[privatize]
|
||||
pub struct EventListenerEntry {
|
||||
|
|
|
@ -29,7 +29,7 @@ use std::cell::Cell;
|
|||
use string_cache::Atom;
|
||||
|
||||
#[jstraceable]
|
||||
#[derive(PartialEq, Copy)]
|
||||
#[derive(PartialEq, Copy, Clone)]
|
||||
#[allow(dead_code)]
|
||||
enum ButtonType {
|
||||
ButtonSubmit,
|
||||
|
|
|
@ -239,7 +239,7 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLElement> {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, PartialEq, Debug)]
|
||||
#[derive(Copy, Clone, PartialEq, Debug)]
|
||||
#[jstraceable]
|
||||
pub enum HTMLElementTypeId {
|
||||
HTMLElement,
|
||||
|
|
|
@ -133,13 +133,13 @@ impl<'a> HTMLFormElementMethods for JSRef<'a, HTMLFormElement> {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Copy)]
|
||||
#[derive(Copy, Clone)]
|
||||
pub enum SubmittedFrom {
|
||||
FromFormSubmitMethod,
|
||||
NotFromFormSubmitMethod
|
||||
}
|
||||
|
||||
#[derive(Copy)]
|
||||
#[derive(Copy, Clone)]
|
||||
pub enum ResetFrom {
|
||||
FromFormResetMethod,
|
||||
NotFromFormResetMethod
|
||||
|
@ -407,21 +407,21 @@ pub struct FormDatum {
|
|||
pub value: DOMString
|
||||
}
|
||||
|
||||
#[derive(Copy)]
|
||||
#[derive(Copy, Clone)]
|
||||
pub enum FormEncType {
|
||||
TextPlainEncoded,
|
||||
UrlEncoded,
|
||||
FormDataEncoded
|
||||
}
|
||||
|
||||
#[derive(Copy)]
|
||||
#[derive(Copy, Clone)]
|
||||
pub enum FormMethod {
|
||||
FormGet,
|
||||
FormPost,
|
||||
FormDialog
|
||||
}
|
||||
|
||||
#[derive(Copy)]
|
||||
#[derive(Copy, Clone)]
|
||||
pub enum FormSubmitter<'a> {
|
||||
FormElement(JSRef<'a, HTMLFormElement>),
|
||||
InputElement(JSRef<'a, HTMLInputElement>),
|
||||
|
|
|
@ -48,7 +48,7 @@ const DEFAULT_SUBMIT_VALUE: &'static str = "Submit";
|
|||
const DEFAULT_RESET_VALUE: &'static str = "Reset";
|
||||
|
||||
#[jstraceable]
|
||||
#[derive(PartialEq, Copy)]
|
||||
#[derive(PartialEq, Copy, Clone)]
|
||||
#[allow(dead_code)]
|
||||
enum InputType {
|
||||
InputSubmit,
|
||||
|
|
|
@ -38,7 +38,7 @@ impl HTMLMediaElement {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, PartialEq, Debug)]
|
||||
#[derive(Copy, Clone, PartialEq, Debug)]
|
||||
#[jstraceable]
|
||||
pub enum HTMLMediaElementTypeId {
|
||||
HTMLAudioElement,
|
||||
|
|
|
@ -16,7 +16,7 @@ use cssparser::RGBA;
|
|||
use util::str::{self, DOMString, LengthOrPercentageOrAuto};
|
||||
use std::cell::Cell;
|
||||
|
||||
#[derive(Copy, PartialEq, Debug)]
|
||||
#[derive(Copy, Clone, PartialEq, Debug)]
|
||||
#[jstraceable]
|
||||
pub enum HTMLTableCellElementTypeId {
|
||||
HTMLTableDataCellElement,
|
||||
|
|
|
@ -190,7 +190,7 @@ impl Drop for Node {
|
|||
/// suppress observers flag
|
||||
/// https://dom.spec.whatwg.org/#concept-node-insert
|
||||
/// https://dom.spec.whatwg.org/#concept-node-remove
|
||||
#[derive(Copy)]
|
||||
#[derive(Copy, Clone)]
|
||||
enum SuppressObserver {
|
||||
Suppressed,
|
||||
Unsuppressed
|
||||
|
@ -266,7 +266,7 @@ impl LayoutDataRef {
|
|||
}
|
||||
|
||||
/// The different types of nodes.
|
||||
#[derive(Copy, PartialEq, Debug)]
|
||||
#[derive(Copy, Clone, PartialEq, Debug)]
|
||||
#[jstraceable]
|
||||
pub enum NodeTypeId {
|
||||
DocumentType,
|
||||
|
@ -1311,7 +1311,7 @@ impl Iterator for TreeIterator {
|
|||
|
||||
|
||||
/// Specifies whether children must be recursively cloned or not.
|
||||
#[derive(Copy, PartialEq)]
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
pub enum CloneChildrenFlag {
|
||||
CloneChildren,
|
||||
DoNotCloneChildren
|
||||
|
|
|
@ -33,7 +33,7 @@ pub struct Sink {
|
|||
|
||||
/// FragmentContext is used only to pass this group of related values
|
||||
/// into functions.
|
||||
#[derive(Copy)]
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct FragmentContext<'a> {
|
||||
pub context_elem: JSRef<'a, Node>,
|
||||
pub form_elem: Option<JSRef<'a, Node>>,
|
||||
|
|
|
@ -34,7 +34,7 @@ use std::rc::Rc;
|
|||
use std::cell::Cell;
|
||||
use url::{Url, UrlParser};
|
||||
|
||||
#[derive(Copy, PartialEq)]
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
#[jstraceable]
|
||||
pub enum WorkerGlobalScopeTypeId {
|
||||
DedicatedGlobalScope,
|
||||
|
|
|
@ -67,7 +67,7 @@ use dom::bindings::codegen::UnionTypes::StringOrURLSearchParams;
|
|||
use dom::bindings::codegen::UnionTypes::StringOrURLSearchParams::{eString, eURLSearchParams};
|
||||
pub type SendParam = StringOrURLSearchParams;
|
||||
|
||||
#[derive(PartialEq, Copy)]
|
||||
#[derive(PartialEq, Copy, Clone)]
|
||||
#[jstraceable]
|
||||
enum XMLHttpRequestState {
|
||||
Unsent = 0,
|
||||
|
|
|
@ -9,7 +9,7 @@ use dom::bindings::codegen::InheritTypes::XMLHttpRequestEventTargetDerived;
|
|||
use dom::bindings::js::JSRef;
|
||||
use dom::eventtarget::{EventTarget, EventTargetHelpers, EventTargetTypeId};
|
||||
|
||||
#[derive(Copy, PartialEq)]
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
#[jstraceable]
|
||||
pub enum XMLHttpRequestEventTargetTypeId {
|
||||
XMLHttpRequest,
|
||||
|
|
|
@ -152,7 +152,7 @@ impl InProgressLoad {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Copy)]
|
||||
#[derive(Copy, Clone)]
|
||||
pub enum TimerSource {
|
||||
FromWindow(PipelineId),
|
||||
FromWorker
|
||||
|
|
|
@ -17,14 +17,14 @@ use std::default::Default;
|
|||
use std::num::SignedInt;
|
||||
use std::sync::mpsc::channel;
|
||||
|
||||
#[derive(Copy, PartialEq)]
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
pub enum Selection {
|
||||
Selected,
|
||||
NotSelected
|
||||
}
|
||||
|
||||
#[jstraceable]
|
||||
#[derive(Copy)]
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct TextPoint {
|
||||
/// 0-based line number
|
||||
pub line: usize,
|
||||
|
|
|
@ -29,7 +29,7 @@ use std::time::duration::Duration;
|
|||
|
||||
#[derive(PartialEq, Eq)]
|
||||
#[jstraceable]
|
||||
#[derive(Copy)]
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct TimerId(i32);
|
||||
|
||||
#[jstraceable]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue