icydb_core/value/coercion.rs
1//! Coercion-routing family classification for `Value`.
2//!
3//! This module defines only coarse routing categories used by coercion tables.
4//! It does not define scalar capabilities.
5
6///
7/// CoercionFamily
8///
9/// Coarse value classification used only for coercion routing.
10/// This classification MUST NOT be used to infer numeric coercion,
11/// arithmetic support, ordering support, or keyability.
12///
13#[derive(Clone, Copy, Debug, Eq, PartialEq)]
14pub enum CoercionFamily {
15 Numeric, // Int, Uint, Decimal, Float, Duration, Timestamp, …
16 Textual, // Text
17 Identifier, // Ulid, Principal, Subaccount
18 Enum, // Enum(type, variant)
19 Collection, // List
20 Blob, // Blob(Vec<u8>)
21 Bool,
22 Null, // Value::Null
23 Unit, // Value::Unit
24}
25
26///
27/// CoercionFamilyExt
28///
29/// Maps a value to its coercion-routing family.
30///
31pub trait CoercionFamilyExt {
32 /// Returns the coercion-routing family for this value.
33 fn coercion_family(&self) -> CoercionFamily;
34}