pub enum TypedValue {
Ref(i64),
Boolean(bool),
Long(i64),
Double(OrderedFloat<f64>),
Instant(DateTime<Utc>),
String(Arc<String>),
Keyword(Arc<Keyword>),
Uuid(Uuid),
Bytes(Bytes),
}Expand description
Represents a value that can be stored in a Mentat store.
Variants§
Ref(i64)
Boolean(bool)
Long(i64)
Double(OrderedFloat<f64>)
Instant(DateTime<Utc>)
String(Arc<String>)
Keyword(Arc<Keyword>)
Uuid(Uuid)
Bytes(Bytes)
Implementations§
Source§impl TypedValue
impl TypedValue
Sourcepub fn is_congruent_with<T>(&self, t: T) -> bool
pub fn is_congruent_with<T>(&self, t: T) -> bool
Returns true if the provided type is Some and matches this value’s type, or if the
provided type is None.
pub fn matches_type(&self, t: ValueType) -> bool
pub fn value_type(&self) -> ValueType
Sourcepub fn typed_ns_keyword<S, T>(ns: S, name: T) -> TypedValue
pub fn typed_ns_keyword<S, T>(ns: S, name: T) -> TypedValue
Construct a new TypedValue::Keyword instance by cloning the provided
values and wrapping them in a new ValueRc. This is expensive, so this might
be best limited to tests.
Sourcepub fn typed_string<S>(s: S) -> TypedValue
pub fn typed_string<S>(s: S) -> TypedValue
Construct a new TypedValue::String instance by cloning the provided
value and wrapping it in a new ValueRc. This is expensive, so this might
be best limited to tests.
pub fn current_instant() -> TypedValue
Sourcepub fn instant(micros: i64) -> TypedValue
pub fn instant(micros: i64) -> TypedValue
Construct a new TypedValue::Instant instance from the provided
microsecond timestamp.
pub fn into_known_entid(self) -> Option<KnownEntid>
pub fn into_entid(self) -> Option<i64>
pub fn into_kw(self) -> Option<Arc<Keyword>>
pub fn into_boolean(self) -> Option<bool>
pub fn into_long(self) -> Option<i64>
pub fn into_double(self) -> Option<f64>
pub fn into_instant(self) -> Option<DateTime<Utc>>
pub fn into_timestamp(self) -> Option<i64>
pub fn into_string(self) -> Option<Arc<String>>
pub fn into_c_string(self) -> Option<*mut i8>
pub fn into_kw_c_string(self) -> Option<*mut i8>
pub fn into_uuid_c_string(self) -> Option<*mut i8>
pub fn into_uuid(self) -> Option<Uuid>
pub fn into_uuid_string(self) -> Option<String>
pub fn into_bytes(self) -> Option<Bytes>
Trait Implementations§
Source§impl Clone for TypedValue
impl Clone for TypedValue
Source§fn clone(&self) -> TypedValue
fn clone(&self) -> TypedValue
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TypedValue
impl Debug for TypedValue
Source§impl<'de> Deserialize<'de> for TypedValue
impl<'de> Deserialize<'de> for TypedValue
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<TypedValue, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<TypedValue, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for TypedValue
Source§impl<'a> From<&'a str> for TypedValue
impl<'a> From<&'a str> for TypedValue
Source§fn from(value: &'a str) -> TypedValue
fn from(value: &'a str) -> TypedValue
Source§impl From<&[u8]> for TypedValue
impl From<&[u8]> for TypedValue
Source§fn from(bslice: &[u8]) -> TypedValue
fn from(bslice: &[u8]) -> TypedValue
Source§impl From<DateTime<Utc>> for TypedValue
Truncate the provided DateTime to microsecond precision, and return the corresponding
TypedValue::Instant.
impl From<DateTime<Utc>> for TypedValue
Truncate the provided DateTime to microsecond precision, and return the corresponding
TypedValue::Instant.
Source§impl From<Keyword> for TypedValue
impl From<Keyword> for TypedValue
Source§fn from(value: Keyword) -> TypedValue
fn from(value: Keyword) -> TypedValue
Source§impl From<KnownEntid> for TypedValue
impl From<KnownEntid> for TypedValue
Source§fn from(k: KnownEntid) -> TypedValue
fn from(k: KnownEntid) -> TypedValue
Source§impl From<String> for TypedValue
impl From<String> for TypedValue
Source§fn from(value: String) -> TypedValue
fn from(value: String) -> TypedValue
Source§impl From<Uuid> for TypedValue
impl From<Uuid> for TypedValue
Source§fn from(value: Uuid) -> TypedValue
fn from(value: Uuid) -> TypedValue
Source§impl From<bool> for TypedValue
impl From<bool> for TypedValue
Source§fn from(value: bool) -> TypedValue
fn from(value: bool) -> TypedValue
Source§impl From<f64> for TypedValue
impl From<f64> for TypedValue
Source§fn from(value: f64) -> TypedValue
fn from(value: f64) -> TypedValue
Source§impl From<i32> for TypedValue
impl From<i32> for TypedValue
Source§fn from(value: i32) -> TypedValue
fn from(value: i32) -> TypedValue
Source§impl From<u32> for TypedValue
impl From<u32> for TypedValue
Source§fn from(value: u32) -> TypedValue
fn from(value: u32) -> TypedValue
Source§impl Hash for TypedValue
impl Hash for TypedValue
Source§impl Ord for TypedValue
impl Ord for TypedValue
Source§fn cmp(&self, other: &TypedValue) -> Ordering
fn cmp(&self, other: &TypedValue) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for TypedValue
impl PartialEq for TypedValue
Source§impl PartialOrd for TypedValue
impl PartialOrd for TypedValue
Source§impl Serialize for TypedValue
impl Serialize for TypedValue
Source§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 TypedValue
Source§impl TransactableValue for TypedValue
impl TransactableValue for TypedValue
Source§fn into_typed_value(
self,
_schema: &Schema,
value_type: ValueType,
) -> Result<TypedValue, DbError>
fn into_typed_value( self, _schema: &Schema, value_type: ValueType, ) -> Result<TypedValue, DbError>
Source§fn into_entity_place(self) -> Result<EntityPlace<TypedValue>, DbError>
fn into_entity_place(self) -> Result<EntityPlace<TypedValue>, DbError>
fn as_tempid(&self) -> Option<TempId>
impl TransactableValueMarker for TypedValue
TypedValue is the value type for programmatic use in transaction builders.
Source§impl TypedSQLValue for TypedValue
impl TypedSQLValue for TypedValue
Source§fn from_sql_value_pair(
value: Value,
value_type_tag: i32,
) -> Result<TypedValue, DbError>
fn from_sql_value_pair( value: Value, value_type_tag: i32, ) -> Result<TypedValue, DbError>
Given a SQLite value and a value_type_tag, return the corresponding TypedValue.
Source§fn from_edn_value(value: &Value) -> Option<TypedValue>
fn from_edn_value(value: &Value) -> Option<TypedValue>
Given an EDN value, return a corresponding Mentat TypedValue.
An EDN Value does not encode a unique Mentat ValueType, so the composition
from_edn_value(first(to_edn_value_pair(...))) loses information. Additionally, there are
EDN values which are not Mentat typed values.
This function is deterministic.
Source§fn to_sql_value_pair(&self) -> (ToSqlOutput<'_>, i32)
fn to_sql_value_pair(&self) -> (ToSqlOutput<'_>, i32)
Return the corresponding SQLite value and value_type_tag pair.
Source§fn to_edn_value_pair(&self) -> (Value, ValueType)
fn to_edn_value_pair(&self) -> (Value, ValueType)
Return the corresponding EDN value and value_type pair.
Auto Trait Implementations§
impl !Freeze for TypedValue
impl RefUnwindSafe for TypedValue
impl Send for TypedValue
impl Sync for TypedValue
impl Unpin for TypedValue
impl UnsafeUnpin for TypedValue
impl UnwindSafe for TypedValue
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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