icydb-core 0.94.3

IcyDB — A schema-first typed query engine and persistence runtime for Internet Computer canisters
Documentation
//! Module: value::coercion
//! Responsibility: coarse coercion-family classification for dynamic values.
//! Does not own: detailed scalar coercion rules or planner/operator semantics.
//! Boundary: lightweight routing surface used by coercion tables.

//! Coercion-routing family classification for `Value`.
//!
//! This module defines only coarse routing categories used by coercion tables.
//! It does not define scalar capabilities.

///
/// CoercionFamily
///
/// Coarse value classification used only for coercion routing.
/// This classification MUST NOT be used to infer numeric coercion,
/// arithmetic support, ordering support, or keyability.
///
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum CoercionFamily {
    Numeric,    // Int, Uint, Decimal, Float, Duration, Timestamp, …
    Textual,    // Text
    Identifier, // Ulid, Principal, Subaccount
    Enum,       // Enum(type, variant)
    Collection, // List
    Blob,       // Blob(Vec<u8>)
    Bool,
    Null, // Value::Null
    Unit, // Value::Unit
}

///
/// CoercionFamilyExt
///
/// Maps a value to its coercion-routing family.
///
pub trait CoercionFamilyExt {
    /// Returns the coercion-routing family for this value.
    fn coercion_family(&self) -> CoercionFamily;
}