Skip to main content

uor_addr/
common.rs

1//! UOR-ADDR's **common architectural surface** — the declarations every
2//! format-specific addressing realization shares.
3//!
4//! Three concentric layers (ARCHITECTURE.md):
5//!
6//! - **Common architectural surface** (this module + [`crate::bounds`] +
7//!   [`crate::resolvers`] + [`crate::label`]) — the single
8//!   [`AddrBounds`] capacity profile, the
9//!   single [`AddressResolverTuple`] ψ-tower, the [`AddressLabel`] output
10//!   shape, and the [`AddressInput`] marker every realization's input
11//!   handle satisfies.
12//! - **Format-specific realizations** (sibling modules) — each names a
13//!   typed-input handle that implements [`AddressInput`] (i.e. produces
14//!   its canonical-form bytes as an ADR-060 source-polymorphic
15//!   [`prism::operation::TermValue`] carrier via `as_binding_value`), plus
16//!   a `prism_model!` binding the shared bounds + resolver tower.
17//! - **Schema-pinned descendants / cost-model variants** — specialize a
18//!   realization with domain-specific structural typing or a non-empty
19//!   `TypedCommitment`.
20//!
21//! ## ADR-060 carrier model
22//!
23//! A realization's canonical form is **not** copied into a fixed buffer.
24//! Its input handle's `as_binding_value` returns a `TermValue` carrier —
25//! `Inline` for canonical forms within the foundation-derived inline
26//! width, `Borrowed` for larger in-memory forms (zero-copy), or `Stream`
27//! ([`prism::uor_foundation::pipeline::ChunkSource`]) for unbounded forms folded
28//! chunk-by-chunk. `run_route` folds the **full** carrier through the
29//! σ-axis with bounded resident memory; the ψ-tower never materializes
30//! it. There is no input size ceiling and no per-stage byte-width cap.
31//!
32//! ## Format-independent ψ-tower
33//!
34//! Because canonicalization happens at carrier production, the
35//! eight-resolver tower ([`AddressResolverTuple`]) is shared verbatim:
36//! ψ₁…ψ₈ thread the carrier through, ψ₉ folds it and emits the κ-label.
37//! No realization carries resolver code.
38
39use prism::pipeline::{ConstrainedTypeShape, IntoBindingValue, PartitionProductFields};
40
41/// **The common input marker — every realization's typed-input handle
42/// implements this.** It bundles the foundation bounds a model `Input`
43/// must satisfy so the handle can flow through `run_route` as an ADR-060
44/// carrier:
45///
46/// - [`ConstrainedTypeShape`] — the constraint geometry (ADR-001/017).
47/// - [`IntoBindingValue`]`<'a>` — `as_binding_value` returns the
48///   canonical-form `TermValue` carrier (ADR-023 amended by ADR-060). The
49///   realization canonicalizes here; ψ₉ only folds.
50/// - [`PartitionProductFields`] — the nerve resolver's field surface.
51///
52/// The realization's host-boundary parser (its own `parse`/`address`
53/// function) builds the handle from raw bytes, validating the format's
54/// typed-input grammar before the typed-iso surface.
55pub trait AddressInput<'a>:
56    ConstrainedTypeShape + IntoBindingValue<'a> + PartitionProductFields + Sized
57{
58}
59
60impl<'a, T> AddressInput<'a> for T where
61    T: ConstrainedTypeShape + IntoBindingValue<'a> + PartitionProductFields + Sized
62{
63}
64
65#[doc(inline)]
66pub use crate::bounds::{AddrBounds, ADDR_INLINE_BYTES};
67#[doc(inline)]
68pub use crate::label::AddressLabel;
69#[doc(inline)]
70pub use crate::resolvers::AddressResolverTuple;
71pub use prism::pipeline::EmptyCommitment;