pub struct JsonDocument { /* private fields */ }Expand description
A collaborative JSON document backed by JsonCrdt.
Implementations§
Source§impl JsonDocument
impl JsonDocument
pub fn new(doc_id: &str, replica_id: &str) -> Self
pub fn set_string(&mut self, path: &str, value: &str) -> Result<(), JsValue>
pub fn set_int(&mut self, path: &str, value: i64) -> Result<(), JsValue>
pub fn set_float(&mut self, path: &str, value: f64) -> Result<(), JsValue>
pub fn set_bool(&mut self, path: &str, value: bool) -> Result<(), JsValue>
pub fn set_null(&mut self, path: &str) -> Result<(), JsValue>
pub fn set_object(&mut self, path: &str) -> Result<(), JsValue>
pub fn set_array(&mut self, path: &str) -> Result<(), JsValue>
pub fn array_push_string( &mut self, path: &str, value: &str, ) -> Result<(), JsValue>
pub fn array_push_int(&mut self, path: &str, value: i64) -> Result<(), JsValue>
pub fn array_push_float( &mut self, path: &str, value: f64, ) -> Result<(), JsValue>
pub fn array_push_bool( &mut self, path: &str, value: bool, ) -> Result<(), JsValue>
pub fn array_push_null(&mut self, path: &str) -> Result<(), JsValue>
pub fn array_remove( &mut self, path: &str, index: usize, ) -> Result<JsValue, JsValue>
pub fn delete(&mut self, path: &str) -> Result<(), JsValue>
pub fn get(&self, path: &str) -> Result<JsValue, JsValue>
pub fn to_json(&self) -> Result<JsValue, JsValue>
pub fn keys(&self) -> Result<JsValue, JsValue>
pub fn contains_key(&self, key: &str) -> bool
pub fn version(&self) -> u64
pub fn doc_id(&self) -> String
pub fn replica_id(&self) -> String
pub fn serialize(&self) -> Result<String, JsValue>
pub fn merge(&mut self, remote_state: &str) -> Result<(), JsValue>
pub fn snapshot(&self) -> Result<JsValue, JsValue>
pub fn restore(snapshot_js: JsValue) -> Result<JsonDocument, JsValue>
Trait Implementations§
Source§impl From<JsonDocument> for JsValue
impl From<JsonDocument> for JsValue
Source§fn from(value: JsonDocument) -> Self
fn from(value: JsonDocument) -> Self
Converts to this type from the input type.
Source§impl FromWasmAbi for JsonDocument
impl FromWasmAbi for JsonDocument
Source§impl IntoWasmAbi for JsonDocument
impl IntoWasmAbi for JsonDocument
Source§impl LongRefFromWasmAbi for JsonDocument
impl LongRefFromWasmAbi for JsonDocument
Source§impl OptionFromWasmAbi for JsonDocument
impl OptionFromWasmAbi for JsonDocument
Source§impl OptionIntoWasmAbi for JsonDocument
impl OptionIntoWasmAbi for JsonDocument
Source§impl RefFromWasmAbi for JsonDocument
impl RefFromWasmAbi for JsonDocument
Source§type Anchor = RcRef<JsonDocument>
type Anchor = RcRef<JsonDocument>
The type that holds the reference to
Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.Source§impl RefMutFromWasmAbi for JsonDocument
impl RefMutFromWasmAbi for JsonDocument
Source§impl TryFromJsValue for JsonDocument
impl TryFromJsValue for JsonDocument
Source§impl VectorFromWasmAbi for JsonDocument
impl VectorFromWasmAbi for JsonDocument
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[JsonDocument]>
Source§impl VectorIntoWasmAbi for JsonDocument
impl VectorIntoWasmAbi for JsonDocument
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[JsonDocument]>) -> Self::Abi
Source§impl WasmDescribeVector for JsonDocument
impl WasmDescribeVector for JsonDocument
impl SupportsConstructor for JsonDocument
impl SupportsInstanceProperty for JsonDocument
impl SupportsStaticProperty for JsonDocument
Auto Trait Implementations§
impl Freeze for JsonDocument
impl RefUnwindSafe for JsonDocument
impl Send for JsonDocument
impl Sync for JsonDocument
impl Unpin for JsonDocument
impl UnsafeUnpin for JsonDocument
impl UnwindSafe for JsonDocument
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
Same as
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.