pub enum LoroValue {
Null,
Bool(bool),
Double(f64),
I64(i64),
Binary(LoroBinaryValue),
String(LoroStringValue),
List(LoroListValue),
Map(LoroMapValue),
Container(ContainerID),
}
Expand description
LoroValue is used to represents the state of CRDT at a given version.
This struct is cheap to clone, the time complexity is O(1).
Variants§
Null
Bool(bool)
Double(f64)
I64(i64)
Binary(LoroBinaryValue)
String(LoroStringValue)
List(LoroListValue)
Map(LoroMapValue)
Container(ContainerID)
Implementations§
Source§impl LoroValue
impl LoroValue
Sourcepub fn as_bool_mut(&mut self) -> Option<&mut bool>
pub fn as_bool_mut(&mut self) -> Option<&mut bool>
Optionally returns mutable references to the inner fields if this is a LoroValue::Bool
, otherwise None
Sourcepub fn as_bool(&self) -> Option<&bool>
pub fn as_bool(&self) -> Option<&bool>
Optionally returns references to the inner fields if this is a LoroValue::Bool
, otherwise None
Sourcepub fn into_bool(self) -> Result<bool, Self>
pub fn into_bool(self) -> Result<bool, Self>
Returns the inner fields if this is a LoroValue::Bool
, otherwise returns back the enum in the Err
case of the result
Sourcepub fn as_double_mut(&mut self) -> Option<&mut f64>
pub fn as_double_mut(&mut self) -> Option<&mut f64>
Optionally returns mutable references to the inner fields if this is a LoroValue::Double
, otherwise None
Sourcepub fn as_double(&self) -> Option<&f64>
pub fn as_double(&self) -> Option<&f64>
Optionally returns references to the inner fields if this is a LoroValue::Double
, otherwise None
Sourcepub fn into_double(self) -> Result<f64, Self>
pub fn into_double(self) -> Result<f64, Self>
Returns the inner fields if this is a LoroValue::Double
, otherwise returns back the enum in the Err
case of the result
Sourcepub fn as_i64_mut(&mut self) -> Option<&mut i64>
pub fn as_i64_mut(&mut self) -> Option<&mut i64>
Optionally returns mutable references to the inner fields if this is a LoroValue::I64
, otherwise None
Sourcepub fn as_i64(&self) -> Option<&i64>
pub fn as_i64(&self) -> Option<&i64>
Optionally returns references to the inner fields if this is a LoroValue::I64
, otherwise None
Sourcepub fn into_i64(self) -> Result<i64, Self>
pub fn into_i64(self) -> Result<i64, Self>
Returns the inner fields if this is a LoroValue::I64
, otherwise returns back the enum in the Err
case of the result
Sourcepub fn as_binary_mut(&mut self) -> Option<&mut LoroBinaryValue>
pub fn as_binary_mut(&mut self) -> Option<&mut LoroBinaryValue>
Optionally returns mutable references to the inner fields if this is a LoroValue::Binary
, otherwise None
Sourcepub fn as_binary(&self) -> Option<&LoroBinaryValue>
pub fn as_binary(&self) -> Option<&LoroBinaryValue>
Optionally returns references to the inner fields if this is a LoroValue::Binary
, otherwise None
Sourcepub fn into_binary(self) -> Result<LoroBinaryValue, Self>
pub fn into_binary(self) -> Result<LoroBinaryValue, Self>
Returns the inner fields if this is a LoroValue::Binary
, otherwise returns back the enum in the Err
case of the result
Sourcepub fn as_string_mut(&mut self) -> Option<&mut LoroStringValue>
pub fn as_string_mut(&mut self) -> Option<&mut LoroStringValue>
Optionally returns mutable references to the inner fields if this is a LoroValue::String
, otherwise None
Sourcepub fn as_string(&self) -> Option<&LoroStringValue>
pub fn as_string(&self) -> Option<&LoroStringValue>
Optionally returns references to the inner fields if this is a LoroValue::String
, otherwise None
Sourcepub fn into_string(self) -> Result<LoroStringValue, Self>
pub fn into_string(self) -> Result<LoroStringValue, Self>
Returns the inner fields if this is a LoroValue::String
, otherwise returns back the enum in the Err
case of the result
Sourcepub fn as_list_mut(&mut self) -> Option<&mut LoroListValue>
pub fn as_list_mut(&mut self) -> Option<&mut LoroListValue>
Optionally returns mutable references to the inner fields if this is a LoroValue::List
, otherwise None
Sourcepub fn as_list(&self) -> Option<&LoroListValue>
pub fn as_list(&self) -> Option<&LoroListValue>
Optionally returns references to the inner fields if this is a LoroValue::List
, otherwise None
Sourcepub fn into_list(self) -> Result<LoroListValue, Self>
pub fn into_list(self) -> Result<LoroListValue, Self>
Returns the inner fields if this is a LoroValue::List
, otherwise returns back the enum in the Err
case of the result
Sourcepub fn as_map_mut(&mut self) -> Option<&mut LoroMapValue>
pub fn as_map_mut(&mut self) -> Option<&mut LoroMapValue>
Optionally returns mutable references to the inner fields if this is a LoroValue::Map
, otherwise None
Sourcepub fn as_map(&self) -> Option<&LoroMapValue>
pub fn as_map(&self) -> Option<&LoroMapValue>
Optionally returns references to the inner fields if this is a LoroValue::Map
, otherwise None
Sourcepub fn into_map(self) -> Result<LoroMapValue, Self>
pub fn into_map(self) -> Result<LoroMapValue, Self>
Returns the inner fields if this is a LoroValue::Map
, otherwise returns back the enum in the Err
case of the result
Sourcepub fn is_container(&self) -> bool
pub fn is_container(&self) -> bool
Returns true if this is a LoroValue::Container
, otherwise false
Sourcepub fn as_container_mut(&mut self) -> Option<&mut ContainerID>
pub fn as_container_mut(&mut self) -> Option<&mut ContainerID>
Optionally returns mutable references to the inner fields if this is a LoroValue::Container
, otherwise None
Sourcepub fn as_container(&self) -> Option<&ContainerID>
pub fn as_container(&self) -> Option<&ContainerID>
Optionally returns references to the inner fields if this is a LoroValue::Container
, otherwise None
Sourcepub fn into_container(self) -> Result<ContainerID, Self>
pub fn into_container(self) -> Result<ContainerID, Self>
Returns the inner fields if this is a LoroValue::Container
, otherwise returns back the enum in the Err
case of the result
Source§impl LoroValue
impl LoroValue
pub fn get_by_key(&self, key: &str) -> Option<&LoroValue>
pub fn get_by_index(&self, index: isize) -> Option<&LoroValue>
pub fn is_false(&self) -> bool
pub fn get_depth(&self) -> usize
pub fn is_too_deep(&self) -> bool
Sourcepub fn visit_children(&self, f: &mut dyn FnMut(&LoroValue))
pub fn visit_children(&self, f: &mut dyn FnMut(&LoroValue))
Visit the all list items or map’s values
pub fn is_empty_collection(&self) -> bool
Trait Implementations§
Source§impl<'a> Arbitrary<'a> for LoroValue
impl<'a> Arbitrary<'a> for LoroValue
Source§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Self
from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Self
from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured
this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured
this type
needs to construct itself. Read moreSource§impl<'de> Deserialize<'de> for LoroValue
impl<'de> Deserialize<'de> for LoroValue
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>,
Source§impl From<ContainerID> for LoroValue
impl From<ContainerID> for LoroValue
Source§fn from(v: ContainerID) -> Self
fn from(v: ContainerID) -> Self
Source§impl FromIterator<LoroValue> for LoroListValue
impl FromIterator<LoroValue> for LoroListValue
Source§impl TryFrom<LoroValue> for ContainerID
impl TryFrom<LoroValue> for ContainerID
impl Eq for LoroValue
impl StructuralPartialEq for LoroValue
Auto Trait Implementations§
impl Freeze for LoroValue
impl RefUnwindSafe for LoroValue
impl Send for LoroValue
impl Sync for LoroValue
impl Unpin for LoroValue
impl UnwindSafe for LoroValue
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more