pub enum CrdtValue {
Text(RGAText),
RichText(RichText),
Json(JsonCrdt),
}Expand description
A CRDT value that can be stored in a document.
Variants§
Text(RGAText)
Plain text.
RichText(RichText)
Rich text with formatting.
Json(JsonCrdt)
Structured JSON data.
Implementations§
Source§impl CrdtValue
impl CrdtValue
pub fn document_type(&self) -> DocumentType
pub fn as_text(&self) -> Option<&RGAText>
pub fn as_text_mut(&mut self) -> Option<&mut RGAText>
pub fn as_rich_text(&self) -> Option<&RichText>
pub fn as_rich_text_mut(&mut self) -> Option<&mut RichText>
pub fn as_json(&self) -> Option<&JsonCrdt>
pub fn as_json_mut(&mut self) -> Option<&mut JsonCrdt>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for CrdtValue
impl<'de> Deserialize<'de> for CrdtValue
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Lattice for CrdtValue
impl Lattice for CrdtValue
Source§fn join(&self, other: &Self) -> Self
fn join(&self, other: &Self) -> Self
Join operation (least upper bound)
Must be commutative, associative, and idempotent
Source§fn partial_cmp_lattice(&self, other: &Self) -> Option<Ordering>
fn partial_cmp_lattice(&self, other: &Self) -> Option<Ordering>
Partial order derived from join: a ≤ b iff a ⊔ b = b
Source§fn join_assign(&mut self, other: &Self)
fn join_assign(&mut self, other: &Self)
Join-assign: self = self ⊔ other
impl StructuralPartialEq for CrdtValue
Auto Trait Implementations§
impl Freeze for CrdtValue
impl RefUnwindSafe for CrdtValue
impl Send for CrdtValue
impl Sync for CrdtValue
impl Unpin for CrdtValue
impl UnwindSafe for CrdtValue
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