pub trait FieldState: Sized {
type Value;
const CRDT_KIND: CrdtKind;
// Required methods
fn encode_state(&self) -> Result<Vec<u8>, RecordError>;
fn decode_state(bytes: &[u8]) -> Result<Self, RecordError>;
fn visible_values(&self) -> Result<Vec<Vec<u8>>, RecordError>;
fn merge_state(&mut self, other: &Self) -> Result<(), RecordError>;
fn canonicalize_for_commit(
&self,
author: AuthorId,
sequence: u64,
context: &VersionVector,
next_operation: &mut u32,
) -> Result<Self, RecordError>;
// Provided method
fn value_type_name() -> &'static str { ... }
}Expand description
Canonical state codec and schema metadata for a replicated field.
Required Associated Constants§
Required Associated Types§
Required Methods§
Sourcefn encode_state(&self) -> Result<Vec<u8>, RecordError>
fn encode_state(&self) -> Result<Vec<u8>, RecordError>
Encodes complete causal field state.
Sourcefn decode_state(bytes: &[u8]) -> Result<Self, RecordError>
fn decode_state(bytes: &[u8]) -> Result<Self, RecordError>
Strictly decodes complete causal field state.
Sourcefn visible_values(&self) -> Result<Vec<Vec<u8>>, RecordError>
fn visible_values(&self) -> Result<Vec<Vec<u8>>, RecordError>
Encodes each currently visible application value for filtering and indexes.
Sourcefn merge_state(&mut self, other: &Self) -> Result<(), RecordError>
fn merge_state(&mut self, other: &Self) -> Result<(), RecordError>
Deterministically merges complete causal state from another replica.
Sourcefn canonicalize_for_commit(
&self,
author: AuthorId,
sequence: u64,
context: &VersionVector,
next_operation: &mut u32,
) -> Result<Self, RecordError>
fn canonicalize_for_commit( &self, author: AuthorId, sequence: u64, context: &VersionVector, next_operation: &mut u32, ) -> Result<Self, RecordError>
Reissues all causal identities from one authenticated commit envelope.
Provided Methods§
Sourcefn value_type_name() -> &'static str
fn value_type_name() -> &'static str
Stable Rust logical value type used in schema compatibility checks.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.