Expand description
Polyfill edge adapters covering every cell of the type
matrix from polydat/docs/design/type_system.md §3 that
has a sensible conversion.
Existing widening + obvious coercions live in
crate::library::convert. This module fills in the rest:
- Numeric narrowings (
U64→U32,I64→I32,F64→F32, …) with range-check panic on out-of-range. - Bool↔every numeric beyond
Bool↔U64. - String parsers (
Str→{U32, I32, I64, F32, Bytes, Json, VecF32, VecI32}) — boundary-only because they can panic on unparseable input. - Bytes serdes with little-endian byte order for
numeric and vector targets, lowercase hex for
Bytes↔Str. - Json serdes with try-parse-or-error-wrap for
Str→Jsonand shape-validating parses elsewhere. - Vec↔{Str, Bytes, Json} serdes;
VecF32↔VecI32casts.
See polydat/src/compile/assembly.rs::auto_adapter and
::boundary_adapter for catalog registration. The split is
by failure mode: anything that can panic on input the
assembler couldn’t verify (range, parse, shape) lives in
boundary_adapter only; lossless widenings live in both
via the boundary_adapter superset relation.
Every cell is authored as an individual #[polydat_node]
free function per SRD-80b §S14 — the macro emits the
matching PascalCase struct (e.g. __u64_to_i32 → U64ToI32),
the impl PolydatNode, and the inventory registration. The
__ prefix on the function identifier carries through to
the DSL/NodeMeta name, which is the convention assembly’s
adapter-detection passes use to identify auto-inserted
type-coercion bridges (name.starts_with("__")).
Structs§
- Bool
ToBytes - The
__bool_to_bytesnode. - Bool
ToF32 - The
__bool_to_f32node. - Bool
ToF64 - The
__bool_to_f64node. - Bool
ToI32 - The
__bool_to_i32node. - Bool
ToI64 - The
__bool_to_i64node. - Bool
ToJson - The
__bool_to_jsonnode. - Bool
ToU32 - The
__bool_to_u32node. - Bytes
ToBool - The
__bytes_to_boolnode. - Bytes
ToF32 - The
__bytes_to_f32node. - Bytes
ToF64 - The
__bytes_to_f64node. - Bytes
ToI32 - The
__bytes_to_i32node. - Bytes
ToI64 - The
__bytes_to_i64node. - Bytes
ToJson - The
__bytes_to_jsonnode. - Bytes
ToStr - The
__bytes_to_strnode. - Bytes
ToU32 - The
__bytes_to_u32node. - Bytes
ToU64 - The
__bytes_to_u64node. - Bytes
ToVec F32 - The
__bytes_to_vec_f32node. - Bytes
ToVec I32 - The
__bytes_to_vec_i32node. - F32To
Bool - The
__f32_to_boolnode. - F32To
Bytes - The
__f32_to_bytesnode. - F32To
I32 - The
__f32_to_i32node. - F32To
I64 - The
__f32_to_i64node. - F32To
Json - The
__f32_to_jsonnode. - F32To
U32 - The
__f32_to_u32node. - F32To
U64 - The
__f32_to_u64node. - F64To
Bool - The
__f64_to_boolnode. - F64To
Bytes - The
__f64_to_bytesnode. - F64To
F32 - The
__f64_to_f32node. - F64To
I32 - The
__f64_to_i32node. - F64To
I64 - The
__f64_to_i64node. - F64To
Json - The
__f64_to_jsonnode. - F64To
U32 - The
__f64_to_u32node. - F64To
U64Checked - The
__f64_to_u64_checkednode. - I32To
Bool - The
__i32_to_boolnode. - I32To
Bytes - The
__i32_to_bytesnode. - I32To
F32 - The
__i32_to_f32node. - I32To
Json - The
__i32_to_jsonnode. - I32To
U32 - The
__i32_to_u32node. - I32To
U64 - The
__i32_to_u64node. - I64To
Bool - The
__i64_to_boolnode. - I64To
Bytes - The
__i64_to_bytesnode. - I64To
F32 - The
__i64_to_f32node. - I64To
I32 - The
__i64_to_i32node. - I64To
Json - The
__i64_to_jsonnode. - I64To
U32 - The
__i64_to_u32node. - I64To
U64 - The
__i64_to_u64node. - Json
ToBool - The
__json_to_boolnode. - Json
ToBytes - The
__json_to_bytesnode. - Json
ToF32 - The
__json_to_f32node. - Json
ToF64 - The
__json_to_f64node. - Json
ToI32 - The
__json_to_i32node. - Json
ToI64 - The
__json_to_i64node. - Json
ToU32 - The
__json_to_u32node. - Json
ToU64 - The
__json_to_u64node. - Json
ToVec F32 - The
__json_to_vec_f32node. - Json
ToVec I32 - The
__json_to_vec_i32node. - StrTo
Bytes - The
__str_to_bytesnode. - StrTo
F32 - The
__str_to_f32node. - StrTo
I32 - The
__str_to_i32node. - StrTo
I64 - The
__str_to_i64node. - StrTo
Json - The
__str_to_jsonnode. - StrTo
U32 - The
__str_to_u32node. - StrTo
VecF32 - The
__str_to_vec_f32node. - StrTo
VecI32 - The
__str_to_vec_i32node. - U32To
Bool - The
__u32_to_boolnode. - U32To
Bytes - The
__u32_to_bytesnode. - U32To
F32 - The
__u32_to_f32node. - U32To
I32 - The
__u32_to_i32node. - U32To
Json - The
__u32_to_jsonnode. - U64To
Bytes - The
__u64_to_bytesnode. - U64To
F32 - The
__u64_to_f32node. - U64To
I32 - The
__u64_to_i32node. - U64To
I64 - The
__u64_to_i64node. - U64To
Json - The
__u64_to_jsonnode. - U64To
U32 - The
__u64_to_u32node. - VecF32
ToBytes - The
__vec_f32_to_bytesnode. - VecF32
ToJson - The
__vec_f32_to_jsonnode. - VecF32
ToStr - The
__vec_f32_to_strnode. - VecF32
ToVec I32 - The
__vec_f32_to_vec_i32node. - VecI32
ToBytes - The
__vec_i32_to_bytesnode. - VecI32
ToJson - The
__vec_i32_to_jsonnode. - VecI32
ToStr - The
__vec_i32_to_strnode. - VecI32
ToVec F32 - The
__vec_i32_to_vec_f32node.