Skip to main content

icydb_core/value/
family.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::None
23    Unit, // Value::Unit
24    Unsupported,
25}
26
27///
28/// CoercionFamilyExt
29///
30/// Maps a value to its coercion-routing family.
31///
32pub trait CoercionFamilyExt {
33    /// Returns the coercion-routing family for this value.
34    fn coercion_family(&self) -> CoercionFamily;
35}