Enum automerge::ScalarValue
source · pub enum ScalarValue {
Bytes(Vec<u8>),
Str(SmolStr),
Int(i64),
Uint(u64),
F64(f64),
Counter(Counter),
Timestamp(i64),
Boolean(bool),
Unknown {
type_code: u8,
bytes: Vec<u8>,
},
Null,
}
Expand description
A value which is not a composite value
Variants§
Bytes(Vec<u8>)
Str(SmolStr)
Int(i64)
Uint(u64)
F64(f64)
Counter(Counter)
Timestamp(i64)
Boolean(bool)
Unknown
A value from a future version of automerge
Null
Implementations§
source§impl ScalarValue
impl ScalarValue
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_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>
pub fn counter(n: i64) -> ScalarValue
Trait Implementations§
source§impl Clone for ScalarValue
impl Clone for ScalarValue
source§fn clone(&self) -> ScalarValue
fn clone(&self) -> ScalarValue
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ScalarValue
impl Debug for ScalarValue
source§impl<'de> Deserialize<'de> for ScalarValue
impl<'de> Deserialize<'de> for ScalarValue
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 Display for ScalarValue
impl Display for ScalarValue
source§impl From<&String> for ScalarValue
impl From<&String> for ScalarValue
source§impl From<&str> for ScalarValue
impl From<&str> for ScalarValue
source§impl From<()> for ScalarValue
impl From<()> for ScalarValue
source§impl From<ScalarValue> for OpType
impl From<ScalarValue> for OpType
source§fn from(v: ScalarValue) -> Self
fn from(v: 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.