Enum ScalarValue
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§
§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>, ScalarValue>
pub fn into_bytes(self) -> Result<Vec<u8>, ScalarValue>
If the ScalarValue is a set of bytes, return the Vec<u8>.
Returns the original value otherwise.
pub fn as_bytes(&self) -> Option<&[u8]>
pub fn as_bytes(&self) -> Option<&[u8]>
If the ScalarValue is a set of Bytes, returns the associated slice of u8.
Returns None otherwise.
pub fn into_string(self) -> Result<String, ScalarValue>
pub fn into_string(self) -> Result<String, ScalarValue>
If the ScalarValue is a string, return the String.
Returns the original value otherwise.
pub fn to_str(&self) -> Option<&str>
👎Deprecated: Use as_str instead
pub fn to_str(&self) -> Option<&str>
Use as_str instead
See ScalarValue::as_str.
pub fn as_str(&self) -> Option<&str>
pub fn as_str(&self) -> Option<&str>
If the ScalarValue is a string, returns the associated str.
Returns None otherwise.
pub fn to_i64(&self) -> Option<i64>
👎Deprecated: Use as_i64 instead
pub fn to_i64(&self) -> Option<i64>
Use as_i64 instead
See ScalarValue::as_i64.
pub fn as_i64(&self) -> Option<i64>
pub fn as_i64(&self) -> Option<i64>
If this ScalarValue is a numeric value, and can be coerced to an
i64, return the i64 value.
pub fn to_u64(&self) -> Option<u64>
👎Deprecated: Use as_u64 instead
pub fn to_u64(&self) -> Option<u64>
Use as_u64 instead
See ScalarValue::as_u64.
pub fn as_u64(&self) -> Option<u64>
pub fn as_u64(&self) -> Option<u64>
If this ScalarValue is a numeric value, and can be coerced to an
u64, return the u64 value.
pub fn to_f64(&self) -> Option<f64>
👎Deprecated: Use as_f64 instead
pub fn to_f64(&self) -> Option<f64>
Use as_f64 instead
See ScalarValue::as_f64.
pub fn as_f64(&self) -> Option<f64>
pub fn as_f64(&self) -> Option<f64>
If this ScalarValue is a numeric value, and can be coerced to an
f64, return the f64 value.
pub fn to_bool(&self) -> Option<bool>
👎Deprecated: Use as_bool instead
pub fn to_bool(&self) -> Option<bool>
Use as_bool instead
See ScalarValue::as_bool.
pub fn as_bool(&self) -> Option<bool>
pub fn as_bool(&self) -> Option<bool>
If this ScalarValue is a boolean, return the bool value.
pub fn counter(n: i64) -> ScalarValue
pub fn counter(n: i64) -> ScalarValue
Construct a ScalarValue::Counter starting with the given i64 value.
Trait Implementations§
§impl Clone for ScalarValue
impl Clone for ScalarValue
§fn clone(&self) -> ScalarValue
fn clone(&self) -> ScalarValue
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for ScalarValue
impl Debug for ScalarValue
§impl<'de> Deserialize<'de> for ScalarValue
impl<'de> Deserialize<'de> for ScalarValue
§fn deserialize<D>(
deserializer: D,
) -> Result<ScalarValue, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<ScalarValue, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
§impl Display for ScalarValue
impl Display for ScalarValue
§impl<'a> From<&'a ScalarValue> for Value<'a>
impl<'a> From<&'a ScalarValue> for Value<'a>
§fn from(v: &'a ScalarValue) -> Value<'a>
fn from(v: &'a ScalarValue) -> Value<'a>
§impl<'a> From<&ScalarValue<'a>> for ScalarValue
impl<'a> From<&ScalarValue<'a>> for ScalarValue
§fn from(s: &ScalarValue<'a>) -> ScalarValue
fn from(s: &ScalarValue<'a>) -> ScalarValue
§impl From<&String> for ScalarValue
impl From<&String> for ScalarValue
§fn from(s: &String) -> ScalarValue
fn from(s: &String) -> ScalarValue
§impl From<&str> for ScalarValue
impl From<&str> for ScalarValue
§fn from(s: &str) -> ScalarValue
fn from(s: &str) -> ScalarValue
§impl From<()> for ScalarValue
impl From<()> for ScalarValue
§fn from(_: ()) -> ScalarValue
fn from(_: ()) -> ScalarValue
§impl From<ScalarValue> for OpType
impl From<ScalarValue> for OpType
§fn from(v: ScalarValue) -> OpType
fn from(v: ScalarValue) -> OpType
§impl From<ScalarValue> for ScalarValue<'_>
impl From<ScalarValue> for ScalarValue<'_>
§fn from(s: ScalarValue) -> ScalarValue<'_>
fn from(s: ScalarValue) -> ScalarValue<'_>
§impl From<ScalarValue> for Value
impl From<ScalarValue> for Value
§fn from(value: ScalarValue) -> Value
fn from(value: ScalarValue) -> Value
§impl From<ScalarValue> for Value<'_>
impl From<ScalarValue> for Value<'_>
§fn from(v: ScalarValue) -> Value<'_>
fn from(v: ScalarValue) -> Value<'_>
§impl<'a> From<ScalarValue<'a>> for ScalarValue
impl<'a> From<ScalarValue<'a>> for ScalarValue
§fn from(s: ScalarValue<'a>) -> ScalarValue
fn from(s: ScalarValue<'a>) -> ScalarValue
§impl From<String> for ScalarValue
impl From<String> for ScalarValue
§fn from(s: String) -> ScalarValue
fn from(s: String) -> ScalarValue
§impl From<Vec<u8>> for ScalarValue
impl From<Vec<u8>> for ScalarValue
§fn from(b: Vec<u8>) -> ScalarValue
fn from(b: Vec<u8>) -> ScalarValue
§impl From<bool> for ScalarValue
impl From<bool> for ScalarValue
§fn from(b: bool) -> ScalarValue
fn from(b: bool) -> ScalarValue
§impl From<char> for ScalarValue
impl From<char> for ScalarValue
§fn from(c: char) -> ScalarValue
fn from(c: char) -> ScalarValue
§impl From<f64> for ScalarValue
impl From<f64> for ScalarValue
§fn from(n: f64) -> ScalarValue
fn from(n: f64) -> ScalarValue
§impl From<i32> for ScalarValue
impl From<i32> for ScalarValue
§fn from(n: i32) -> ScalarValue
fn from(n: i32) -> ScalarValue
§impl From<i64> for ScalarValue
impl From<i64> for ScalarValue
§fn from(n: i64) -> ScalarValue
fn from(n: i64) -> ScalarValue
§impl From<u32> for ScalarValue
impl From<u32> for ScalarValue
§fn from(n: u32) -> ScalarValue
fn from(n: u32) -> ScalarValue
§impl From<u64> for ScalarValue
impl From<u64> for ScalarValue
§fn from(n: u64) -> ScalarValue
fn from(n: u64) -> ScalarValue
§impl PartialEq<ScalarValue> for ScalarValue<'_>
impl PartialEq<ScalarValue> for ScalarValue<'_>
§impl PartialEq<ScalarValue<'_>> for ScalarValue
impl PartialEq<ScalarValue<'_>> for ScalarValue
§impl PartialEq for ScalarValue
impl PartialEq for ScalarValue
§impl Serialize for ScalarValue
impl Serialize for ScalarValue
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
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 UnsafeUnpin for ScalarValue
impl UnwindSafe for ScalarValue
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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