pub enum Value<'a> {
Object(ObjType),
Scalar(Cow<'a, ScalarValue>),
}
Expand description
The type of values in an automerge document
Variants§
Object(ObjType)
An composite object of type ObjType
Scalar(Cow<'a, ScalarValue>)
A non composite value
Implementations§
source§impl<'a> Value<'a>
impl<'a> Value<'a>
pub fn map() -> Value<'a>
pub fn list() -> Value<'a>
pub fn text() -> Value<'a>
pub fn table() -> Value<'a>
pub fn str(s: &str) -> Value<'a>
pub fn int(n: i64) -> Value<'a>
pub fn uint(n: u64) -> Value<'a>
pub fn counter(n: i64) -> Value<'a>
pub fn timestamp(n: i64) -> Value<'a>
pub fn f64(n: f64) -> Value<'a>
pub fn bytes(b: Vec<u8>) -> Value<'a>
pub fn is_object(&self) -> bool
pub fn is_scalar(&self) -> bool
pub fn is_bytes(&self) -> bool
pub fn is_str(&self) -> bool
pub fn is_int(&self) -> bool
pub fn is_uint(&self) -> bool
pub fn is_f64(&self) -> bool
pub fn is_counter(&self) -> bool
pub fn is_timestamp(&self) -> bool
pub fn is_boolean(&self) -> bool
pub fn is_null(&self) -> bool
pub fn into_scalar(self) -> Result<ScalarValue, Self>
pub fn to_scalar(&self) -> Option<&ScalarValue>
pub fn to_objtype(&self) -> Option<ObjType>
pub fn into_owned(self) -> Value<'static>
pub fn to_owned(&self) -> Value<'static>
pub fn into_bytes(self) -> Result<Vec<u8>, Self>
pub fn to_bytes(&self) -> Option<&[u8]>
pub fn into_string(self) -> Result<String, Self>
pub fn to_str(&self) -> Option<&str>
sourcepub fn to_i64(&self) -> Option<i64>
pub fn to_i64(&self) -> Option<i64>
If this value can be coerced to an i64, return the i64 value
pub fn to_u64(&self) -> Option<u64>
pub fn to_f64(&self) -> Option<f64>
pub fn to_bool(&self) -> Option<bool>
Trait Implementations§
source§impl<'a> From<&'a ScalarValue> for Value<'a>
impl<'a> From<&'a ScalarValue> for Value<'a>
source§fn from(v: &'a ScalarValue) -> Self
fn from(v: &'a ScalarValue) -> Self
Converts to this type from the input type.
source§impl<'a> From<ScalarValue> for Value<'a>
impl<'a> From<ScalarValue> for Value<'a>
source§fn from(v: ScalarValue) -> Self
fn from(v: ScalarValue) -> Self
Converts to this type from the input type.
source§impl<'a> PartialEq<Value<'a>> for Value<'a>
impl<'a> PartialEq<Value<'a>> for Value<'a>
impl<'a> StructuralPartialEq for Value<'a>
Auto Trait Implementations§
impl<'a> RefUnwindSafe for Value<'a>
impl<'a> Send for Value<'a>
impl<'a> Sync for Value<'a>
impl<'a> Unpin for Value<'a>
impl<'a> UnwindSafe for Value<'a>
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