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<'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 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.
source§impl From<String> for ScalarValue
impl From<String> for ScalarValue
source§impl From<bool> for ScalarValue
impl From<bool> for ScalarValue
source§impl From<char> for ScalarValue
impl From<char> for ScalarValue
source§impl From<f64> for ScalarValue
impl From<f64> for ScalarValue
source§impl From<i32> for ScalarValue
impl From<i32> for ScalarValue
source§impl From<i64> for ScalarValue
impl From<i64> for ScalarValue
source§impl From<u32> for ScalarValue
impl From<u32> for ScalarValue
source§impl From<u64> for ScalarValue
impl From<u64> for ScalarValue
source§impl PartialEq for ScalarValue
impl PartialEq for ScalarValue
source§impl Serialize for ScalarValue
impl Serialize for ScalarValue
impl StructuralPartialEq for ScalarValue
Auto Trait Implementations§
impl Freeze for ScalarValue
impl RefUnwindSafe for ScalarValue
impl Send for ScalarValue
impl Sync for ScalarValue
impl Unpin for ScalarValue
impl UnwindSafe for ScalarValue
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)