pub trait CrdtState:
Send
+ Sync
+ 'static {
// Required methods
fn as_any(&self) -> &dyn Any;
fn apply(&mut self, op: &CrdtOp) -> Result<(), FnError>;
fn merge(&mut self, other: &dyn CrdtState) -> Result<(), FnError>;
fn value(&self) -> Result<ScalarValue, FnError>;
fn persist(&self) -> Result<Vec<u8>, FnError>;
}Expand description
Per-instance CRDT state.
'static is required so CrdtState::as_any can downcast safely in
merge implementations to access the concrete other-state.
Required Methods§
Sourcefn as_any(&self) -> &dyn Any
fn as_any(&self) -> &dyn Any
Return &dyn Any for safe downcasting in merge implementations.
Implementations should expose as_any with the one-liner
fn as_any(&self) -> &dyn std::any::Any { self }.
Sourcefn value(&self) -> Result<ScalarValue, FnError>
fn value(&self) -> Result<ScalarValue, FnError>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".