pub enum Value {
Show 24 variants
Account(Account),
Blob(Vec<u8>),
Bool(bool),
Date(Date),
Decimal(Decimal),
Duration(Duration),
Enum(ValueEnum),
Float32(Float32),
Float64(Float64),
Int(i64),
Int128(Int128),
IntBig(Int),
List(Vec<Self>),
Map(Vec<(Self, Self)>),
Null,
Principal(Principal),
Subaccount(Subaccount),
Text(String),
Timestamp(Timestamp),
Uint(u64),
Uint128(Nat128),
UintBig(Nat),
Ulid(Ulid),
Unit,
}Variants§
Account(Account)
Blob(Vec<u8>)
Bool(bool)
Date(Date)
Decimal(Decimal)
Duration(Duration)
Enum(ValueEnum)
Float32(Float32)
Float64(Float64)
Int(i64)
Int128(Int128)
IntBig(Int)
List(Vec<Self>)
Ordered list of values. Used for many-cardinality transport. List order is preserved for normalization and fingerprints.
Map(Vec<(Self, Self)>)
Canonical deterministic map representation.
- Maps are unordered values; insertion order is discarded.
- Entries are always sorted by canonical key order and keys are unique.
- Map fields remain non-queryable and persist as atomic value replacements.
- Persistence treats map fields as atomic value replacements per row save.
Null
Principal(Principal)
Subaccount(Subaccount)
Text(String)
Timestamp(Timestamp)
Uint(u64)
Uint128(Nat128)
UintBig(Nat)
Ulid(Ulid)
Unit
Implementations§
Source§impl Value
impl Value
Sourcepub fn validate_map_entries(
entries: &[(Self, Self)],
) -> Result<(), MapValueError>
pub fn validate_map_entries( entries: &[(Self, Self)], ) -> Result<(), MapValueError>
Validate map entry invariants without changing order.
Sourcepub fn normalize_map_entries(
entries: Vec<(Self, Self)>,
) -> Result<Vec<(Self, Self)>, MapValueError>
pub fn normalize_map_entries( entries: Vec<(Self, Self)>, ) -> Result<Vec<(Self, Self)>, MapValueError>
Normalize map entries into canonical deterministic order.
Source§impl Value
impl Value
pub const fn is_empty(&self) -> Option<bool>
Sourcepub fn is_not_empty(&self) -> Option<bool>
pub fn is_not_empty(&self) -> Option<bool>
Logical negation of is_empty.
Sourcepub fn contains(&self, needle: &Self) -> Option<bool>
pub fn contains(&self, needle: &Self) -> Option<bool>
Returns true if self contains needle (or equals it for scalars).
Sourcepub fn contains_any(&self, needles: &Self) -> Option<bool>
pub fn contains_any(&self, needles: &Self) -> Option<bool>
Returns true if any item in needles matches a member of self.
Sourcepub fn contains_all(&self, needles: &Self) -> Option<bool>
pub fn contains_all(&self, needles: &Self) -> Option<bool>
Returns true if every item in needles matches a member of self.
Sourcepub fn in_list(&self, haystack: &Self) -> Option<bool>
pub fn in_list(&self, haystack: &Self) -> Option<bool>
Returns true if self exists inside the provided list.
Sourcepub fn contains_ci(&self, needle: &Self) -> Option<bool>
pub fn contains_ci(&self, needle: &Self) -> Option<bool>
Case-insensitive contains supporting text and identifier variants.
Sourcepub fn contains_any_ci(&self, needles: &Self) -> Option<bool>
pub fn contains_any_ci(&self, needles: &Self) -> Option<bool>
Case-insensitive variant of contains_any.
Sourcepub fn contains_all_ci(&self, needles: &Self) -> Option<bool>
pub fn contains_all_ci(&self, needles: &Self) -> Option<bool>
Case-insensitive variant of contains_all.
Sourcepub fn in_list_ci(&self, haystack: &Self) -> Option<bool>
pub fn in_list_ci(&self, haystack: &Self) -> Option<bool>
Case-insensitive variant of in_list.
Source§impl Value
impl Value
Sourcepub fn cmp_numeric(&self, other: &Self) -> Option<Ordering>
pub fn cmp_numeric(&self, other: &Self) -> Option<Ordering>
Compare two runtime values under value-local numeric coercion semantics.
Database execution code should use db::numeric helpers as the
canonical runtime boundary; this method remains the representation-local
comparison primitive that those higher-level helpers are tested against.
Source§impl Value
impl Value
Sourcepub fn text_eq(&self, other: &Self, mode: TextMode) -> Option<bool>
pub fn text_eq(&self, other: &Self, mode: TextMode) -> Option<bool>
Case-sensitive/insensitive equality check for text-like values.
Sourcepub fn text_contains(&self, needle: &Self, mode: TextMode) -> Option<bool>
pub fn text_contains(&self, needle: &Self, mode: TextMode) -> Option<bool>
Check whether other is a substring of self under the given text mode.
Sourcepub fn text_starts_with(&self, needle: &Self, mode: TextMode) -> Option<bool>
pub fn text_starts_with(&self, needle: &Self, mode: TextMode) -> Option<bool>
Check whether self starts with other under the given text mode.
Sourcepub fn text_ends_with(&self, needle: &Self, mode: TextMode) -> Option<bool>
pub fn text_ends_with(&self, needle: &Self, mode: TextMode) -> Option<bool>
Check whether self ends with other under the given text mode.
Source§impl Value
impl Value
Sourcepub const fn is_numeric(&self) -> bool
pub const fn is_numeric(&self) -> bool
Returns true if the value is one of the numeric-like variants supported by numeric comparison/ordering.
Sourcepub const fn supports_numeric_coercion(&self) -> bool
pub const fn supports_numeric_coercion(&self) -> bool
Returns true when numeric coercion/comparison is explicitly allowed.
Source§impl Value
impl Value
pub const __KIND: FieldKind
pub const __STORAGE_DECODE: FieldStorageDecode = FieldStorageDecode::Value
Source§impl Value
impl Value
Sourcepub fn from_slice<T>(items: &[T]) -> Self
pub fn from_slice<T>(items: &[T]) -> Self
CONSTRUCTION
Build a Value::List from a list literal.
Intended for tests and inline construction.
Requires Clone because items are borrowed.
Sourcepub fn from_list<T>(items: Vec<T>) -> Selfwhere
T: Into<Self>,
pub fn from_list<T>(items: Vec<T>) -> Selfwhere
T: Into<Self>,
Build a Value::List from owned items.
This is the canonical constructor for query / DTO boundaries.
Sourcepub fn from_map(entries: Vec<(Self, Self)>) -> Result<Self, MapValueError>
pub fn from_map(entries: Vec<(Self, Self)>) -> Result<Self, MapValueError>
Build a canonical Value::Map from owned key/value entries.
Invariants are validated and entries are normalized:
- keys must be scalar and non-null
- values may be scalar or structured
- entries are sorted by canonical key order
- duplicate keys are rejected
Sourcepub fn from_enum<E: EnumValue>(value: E) -> Self
pub fn from_enum<E: EnumValue>(value: E) -> Self
Build a Value::Enum from a domain enum using its explicit mapping.
Sourcepub fn enum_strict<E: Path>(variant: &str) -> Self
pub fn enum_strict<E: Path>(variant: &str) -> Self
Build a strict enum value using the canonical path of E.
Sourcepub const fn is_unit(&self) -> bool
pub const fn is_unit(&self) -> bool
Returns true if the value is Unit (used for presence/null comparators).
pub const fn is_scalar(&self) -> bool
Sourcepub fn canonical_cmp_key(left: &Self, right: &Self) -> Ordering
pub fn canonical_cmp_key(left: &Self, right: &Self) -> Ordering
Total canonical comparator used for map-key normalization.
Sourcepub const fn as_storage_key(&self) -> Option<StorageKey>
pub const fn as_storage_key(&self) -> Option<StorageKey>
CONVERSION
NOTE:
Unit is intentionally treated as a valid storage key and indexable,
used for singleton tables and synthetic identity entities.
Only Null is non-indexable.
pub const fn as_text(&self) -> Option<&str>
pub const fn as_list(&self) -> Option<&[Self]>
pub const fn as_map(&self) -> Option<&[(Self, Self)]>
Trait Implementations§
Source§impl CandidType for Value
impl CandidType for Value
Source§impl CoercionFamilyExt for Value
impl CoercionFamilyExt for Value
Source§fn coercion_family(&self) -> CoercionFamily
fn coercion_family(&self) -> CoercionFamily
Returns the coercion-routing family for this value.
NOTE: This does NOT imply numeric, arithmetic, ordering, or keyability support. All scalar capabilities are registry-driven.
Source§impl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
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>,
Source§impl FieldTypeMeta for Value
impl FieldTypeMeta for Value
Source§const STORAGE_DECODE: FieldStorageDecode = FieldStorageDecode::Value
const STORAGE_DECODE: FieldStorageDecode = FieldStorageDecode::Value
Source§const NESTED_FIELDS: &'static [FieldModel] = _
const NESTED_FIELDS: &'static [FieldModel] = _
Source§impl From<&InputValue> for Value
impl From<&InputValue> for Value
Source§fn from(value: &InputValue) -> Self
fn from(value: &InputValue) -> Self
Source§impl From<&Value> for InputValue
impl From<&Value> for InputValue
Source§impl From<&Value> for OutputValue
impl From<&Value> for OutputValue
Source§impl From<InputValue> for Value
impl From<InputValue> for Value
Source§fn from(value: InputValue) -> Self
fn from(value: InputValue) -> Self
Source§impl From<Subaccount> for Value
impl From<Subaccount> for Value
Source§fn from(v: Subaccount) -> Self
fn from(v: Subaccount) -> Self
Source§impl From<Value> for InputValue
impl From<Value> for InputValue
Source§impl From<Value> for OutputValue
impl From<Value> for OutputValue
Source§impl PartialOrd for Value
impl PartialOrd for Value
Source§impl PersistedStructuredFieldCodec for Value
impl PersistedStructuredFieldCodec for Value
Source§fn encode_persisted_structured_payload(&self) -> Result<Vec<u8>, InternalError>
fn encode_persisted_structured_payload(&self) -> Result<Vec<u8>, InternalError>
Source§fn decode_persisted_structured_payload(
bytes: &[u8],
) -> Result<Self, InternalError>
fn decode_persisted_structured_payload( bytes: &[u8], ) -> Result<Self, InternalError>
Source§impl RuntimeValueDecode for Value
impl RuntimeValueDecode for Value
fn from_value(value: &Value) -> Option<Self>
Source§impl RuntimeValueMeta for Value
impl RuntimeValueMeta for Value
fn kind() -> RuntimeValueKind
impl Eq for Value
impl StructuralPartialEq for Value
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnsafeUnpin for Value
impl UnwindSafe for Value
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<T> KeyValueCodec for Twhere
T: RuntimeValueDecode + RuntimeValueEncode,
impl<T> KeyValueCodec for Twhere
T: RuntimeValueDecode + RuntimeValueEncode,
fn to_key_value(&self) -> Value
fn from_key_value(value: &Value) -> Option<T>
Source§impl<T> PersistedFieldMetaCodec for T
impl<T> PersistedFieldMetaCodec for T
Source§fn encode_persisted_slot_payload_by_meta(
&self,
field_name: &'static str,
) -> Result<Vec<u8>, InternalError>
fn encode_persisted_slot_payload_by_meta( &self, field_name: &'static str, ) -> Result<Vec<u8>, InternalError>
FieldTypeMeta storage contract.Source§fn decode_persisted_slot_payload_by_meta(
bytes: &[u8],
field_name: &'static str,
) -> Result<T, InternalError>
fn decode_persisted_slot_payload_by_meta( bytes: &[u8], field_name: &'static str, ) -> Result<T, InternalError>
FieldTypeMeta storage contract.Source§fn encode_persisted_option_slot_payload_by_meta(
value: &Option<T>,
field_name: &'static str,
) -> Result<Vec<u8>, InternalError>
fn encode_persisted_option_slot_payload_by_meta( value: &Option<T>, field_name: &'static str, ) -> Result<Vec<u8>, InternalError>
FieldTypeMeta storage contract.Source§fn decode_persisted_option_slot_payload_by_meta(
bytes: &[u8],
field_name: &'static str,
) -> Result<Option<T>, InternalError>
fn decode_persisted_option_slot_payload_by_meta( bytes: &[u8], field_name: &'static str, ) -> Result<Option<T>, InternalError>
FieldTypeMeta storage contract.