Enum loro_internal::event::Diff
source · #[non_exhaustive]pub enum Diff {
List(Delta<Vec<LoroValue>>),
Text(Delta<StringSlice, StyleMeta>),
NewMap(MapDelta),
Tree(TreeDiff),
}Expand description
Diff is the diff between two versions of a container. It’s used to describe the change of a container and the events.
Internal
Text index variants:
- When
wasmis enabled, it should use utf16 indexes. - When
wasmis disabled, it should use unicode indexes.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
List(Delta<Vec<LoroValue>>)
Text(Delta<StringSlice, StyleMeta>)
- When feature
wasmis enabled, it should use utf16 indexes. - When feature
wasmis disabled, it should use unicode indexes.
NewMap(MapDelta)
Tree(TreeDiff)
Implementations§
source§impl Diff
impl Diff
sourcepub fn as_list_mut(&mut self) -> Option<&mut Delta<Vec<LoroValue>>>
pub fn as_list_mut(&mut self) -> Option<&mut Delta<Vec<LoroValue>>>
Optionally returns mutable references to the inner fields if this is a Diff::List, otherwise None
sourcepub fn as_list(&self) -> Option<&Delta<Vec<LoroValue>>>
pub fn as_list(&self) -> Option<&Delta<Vec<LoroValue>>>
Optionally returns references to the inner fields if this is a Diff::List, otherwise None
sourcepub fn into_list(self) -> Result<Delta<Vec<LoroValue>>, Self>
pub fn into_list(self) -> Result<Delta<Vec<LoroValue>>, Self>
Returns the inner fields if this is a Diff::List, otherwise returns back the enum in the Err case of the result
sourcepub fn as_text_mut(&mut self) -> Option<&mut Delta<StringSlice, StyleMeta>>
pub fn as_text_mut(&mut self) -> Option<&mut Delta<StringSlice, StyleMeta>>
Optionally returns mutable references to the inner fields if this is a Diff::Text, otherwise None
sourcepub fn as_text(&self) -> Option<&Delta<StringSlice, StyleMeta>>
pub fn as_text(&self) -> Option<&Delta<StringSlice, StyleMeta>>
Optionally returns references to the inner fields if this is a Diff::Text, otherwise None
sourcepub fn into_text(self) -> Result<Delta<StringSlice, StyleMeta>, Self>
pub fn into_text(self) -> Result<Delta<StringSlice, StyleMeta>, Self>
Returns the inner fields if this is a Diff::Text, otherwise returns back the enum in the Err case of the result
sourcepub fn as_new_map_mut(&mut self) -> Option<&mut MapDelta>
pub fn as_new_map_mut(&mut self) -> Option<&mut MapDelta>
Optionally returns mutable references to the inner fields if this is a Diff::NewMap, otherwise None
sourcepub fn as_new_map(&self) -> Option<&MapDelta>
pub fn as_new_map(&self) -> Option<&MapDelta>
Optionally returns references to the inner fields if this is a Diff::NewMap, otherwise None
sourcepub fn into_new_map(self) -> Result<MapDelta, Self>
pub fn into_new_map(self) -> Result<MapDelta, Self>
Returns the inner fields if this is a Diff::NewMap, otherwise returns back the enum in the Err case of the result
sourcepub fn as_tree_mut(&mut self) -> Option<&mut TreeDiff>
pub fn as_tree_mut(&mut self) -> Option<&mut TreeDiff>
Optionally returns mutable references to the inner fields if this is a Diff::Tree, otherwise None