diff --git a/worker-sys/src/types/durable_object.rs b/worker-sys/src/types/durable_object.rs index cb0f53f2..04f8503c 100644 --- a/worker-sys/src/types/durable_object.rs +++ b/worker-sys/src/types/durable_object.rs @@ -15,6 +15,7 @@ pub use transaction::*; #[wasm_bindgen] extern "C" { #[wasm_bindgen(extends=js_sys::Object)] + #[derive(Clone)] pub type DurableObject; #[wasm_bindgen(method, catch, js_name=fetch)] diff --git a/worker-sys/src/types/durable_object/namespace.rs b/worker-sys/src/types/durable_object/namespace.rs index f75453a7..e7ba7600 100644 --- a/worker-sys/src/types/durable_object/namespace.rs +++ b/worker-sys/src/types/durable_object/namespace.rs @@ -5,6 +5,7 @@ use crate::types::{DurableObject, DurableObjectId}; #[wasm_bindgen] extern "C" { #[wasm_bindgen(extends=js_sys::Object)] + #[derive(Clone)] pub type DurableObjectNamespace; #[wasm_bindgen(method, catch, js_name=idFromName)] diff --git a/worker/src/durable.rs b/worker/src/durable.rs index fdd19acc..cd2a507d 100644 --- a/worker/src/durable.rs +++ b/worker/src/durable.rs @@ -40,6 +40,9 @@ pub struct Stub { inner: EdgeDurableObject, } +unsafe impl Send for Stub {} +unsafe impl Sync for Stub {} + impl Stub { /// Send an internal Request to the Durable Object to which the stub points. pub async fn fetch_with_request(&self, req: Request) -> Result { @@ -59,10 +62,14 @@ impl Stub { /// Use an ObjectNamespace to get access to Stubs for communication with a Durable Object instance. /// A given namespace can support essentially unlimited Durable Objects, with each Object having /// access to a transactional, key-value storage API. +#[derive(Clone)] pub struct ObjectNamespace { inner: EdgeObjectNamespace, } +unsafe impl Send for ObjectNamespace {} +unsafe impl Sync for ObjectNamespace {} + impl ObjectNamespace { /// This method derives a unique object ID from the given name string. It will always return the /// same ID when given the same name as input.