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