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<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.