worker_sys/types/durable_object/
id.rs1use wasm_bindgen::prelude::*;
2
3#[wasm_bindgen]
4extern "C" {
5 #[wasm_bindgen(extends=js_sys::Object)]
6 pub type DurableObjectId;
7
8 #[wasm_bindgen(method, catch, js_name=toString)]
9 pub fn to_string(this: &DurableObjectId) -> Result<String, JsValue>;
10
11 #[wasm_bindgen(method)]
12 pub fn equals(this: &DurableObjectId, other: &DurableObjectId) -> bool;
13
14 #[wasm_bindgen(method, getter)]
15 pub fn name(this: &DurableObjectId) -> Option<String>;
16}
17
18impl core::fmt::Debug for DurableObjectId {
19 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
20 f.debug_struct("DurableObjectId")
21 .field("name", &self.name())
22 .finish()
23 }
24}