Skip to main content

boundary_adapter

Function boundary_adapter 

Source
pub fn boundary_adapter(
    from: PortType,
    to: PortType,
) -> Option<Box<dyn PolydatNode>>
Expand description

Boundary adapter catalog. Consulted by adapt_boundary_value when a host-injected scope value crosses into a typed slot. Strictly a superset of auto_adapter: every intra-graph adapter is also a boundary adapter, plus all the lossy / parseable / shape- checking adapters that can panic on input the assembler can’t statically verify.

Boundary-only adapters fall into four classes:

  • Numeric narrowingsU64→{U32, I64, I32, F32}, F64→{U64, U32, I64, I32, F32}, etc. Range-checked, panic on out-of-range.
  • Str → X parsers — workload-param flow (YAML string interpolations, comma-split iter-values). Panic on unparseable input.
  • Bytes → X parsers — wrong-length panics. Numeric reads expect exactly sizeof(N) bytes; Vec reads expect a multiple of sizeof(element).
  • Json → X extractors — shape mismatch panics (Json::Array expected for Vec; Json::Number for numerics; etc.).

Plus a small set of “almost-auto” adapters that the assembler can’t promote because they panic on non-finite floats: F64→Json, F32→Json, VecF32→Json, VecF32→Str.

See polydat/docs/design/type_system.md.