Skip to main content

RouteShape

Struct RouteShape 

Source
pub struct RouteShape<const TARGET_LABEL_BYTES: usize, const ENDPOINT_BYTES: usize, const TIME_PAIR_BYTES: usize, const SIG_LABEL_BYTES: usize, const COMMIT_LABEL_BYTES: usize>;
Expand description

A publication-graph route declaration shape — the structural type identity an application uses to publish a route from a content κ-label to a service endpoint over a UorTime validity window, witnessed by a signature κ-label and bound to a commitment-root κ-label.

Per AGENTS.md § 11.1, the shape carries no operation logic and no resolvers — it is the typed-distinction surface only. The application’s realization supplies the operational semantics: the canonicalize function that serializes the five components into the shape’s SITE_COUNT sites, the SignatureAxis impl that authenticates the signature κ-label, the CommitmentAxis impl that verifies the commitment-root κ-label, and the Calibration that interprets the time-pair’s physical bounds.

The five const-generic parameters fix the per-component byte widths:

  • TARGET_LABEL_BYTES — the κ-label being routed (71 for sha256/blake3, 73 for sha3-256, 74 for keccak256; see uor_addr::hash::label_bytes).
  • ENDPOINT_BYTES — application-encoded service endpoint width; application-policy (e.g., 32 for a fixed-width peer identifier, wider for a multiaddr).
  • TIME_PAIR_BYTES — width of the realization’s encoding of the (valid-from, valid-until) UorTime pair. The foundation exposes no fixed wire format for UorTime; the realization architect commits the encoding (e.g., big-endian f64 + big-endian u64 per value, yielding 32 bytes; or a compact varint encoding yielding less).
  • SIG_LABEL_BYTES — the signature κ-label width (per chosen σ-axis).
  • COMMIT_LABEL_BYTES — the commitment-root κ-label width (per chosen σ-axis).

SITE_COUNT is the sum of all five widths. The Rust type system distinguishes RouteShape<A,B,C,D,E> from any RouteShape<A',B',C',D',E'> with different widths, even when SITE_COUNT is numerically equal — this is the type-system-level naming that gives applications a typed handle distinguishing route declarations from other shapes carrying the same byte count.

The shape’s IRI is https://uor.foundation/type/ConstrainedType per the closure rule (AGENTS.md § 11.3) — empty-CONSTRAINTS shapes share the foundation’s class IRI.

§See also

§Constraints

  • TC-01 — admission is compile-time.
  • TC-04 — bilateral compile-time enforcement.
  • ADR-013 — closure under uor-foundation.
  • ADR-017 — content-addressed identity via the IRI.
  • ADR-031 — composes with prism-crypto + prism-fhe Layer-3 axes.

§Behavior

use prism::pipeline::ConstrainedTypeShape;
use prism::std_types::RouteShape;

// Given an application committing the sha256 σ-axis across all three
// κ-label positions, a 32-byte peer-id endpoint, and a 32-byte
// time-pair encoding (big-endian f64 + big-endian u64 per value):
type R = RouteShape<71, 32, 32, 71, 71>;
// When SITE_COUNT is queried,
// Then it equals the sum of the five widths.
assert_eq!(<R as ConstrainedTypeShape>::SITE_COUNT, 71 + 32 + 32 + 71 + 71);
// And the shape shares the closure-under-foundation class IRI.
assert_eq!(
    <R as ConstrainedTypeShape>::IRI,
    "https://uor.foundation/type/ConstrainedType",
);
// And carries no embedded constraints.
assert!(<R as ConstrainedTypeShape>::CONSTRAINTS.is_empty());

// Given a different application choosing keccak256 across the κ-labels:
type RK = RouteShape<74, 32, 32, 74, 74>;
// When SITE_COUNT is queried,
// Then the shape widens to reflect the wider keccak256 labels.
assert_eq!(<RK as ConstrainedTypeShape>::SITE_COUNT, 74 + 32 + 32 + 74 + 74);

Trait Implementations§

Source§

impl<const TARGET_LABEL_BYTES: usize, const ENDPOINT_BYTES: usize, const TIME_PAIR_BYTES: usize, const SIG_LABEL_BYTES: usize, const COMMIT_LABEL_BYTES: usize> ConstrainedTypeShape for RouteShape<TARGET_LABEL_BYTES, ENDPOINT_BYTES, TIME_PAIR_BYTES, SIG_LABEL_BYTES, COMMIT_LABEL_BYTES>

Source§

const IRI: &'static str = "https://uor.foundation/type/ConstrainedType"

IRI of the ontology type:ConstrainedType instance this shape represents.
Source§

const SITE_COUNT: usize

Number of sites (fields) this constrained type carries.
Source§

const CONSTRAINTS: &'static [ConstraintRef]

Per-site constraint list. Empty means unconstrained.
Source§

const CYCLE_SIZE: u64

ADR-032: cardinality of the shape’s value-set (the cycle structure of the shape under the substrate’s discrete-clock model). Used by the prism_model! macro to lower first_admit (closure-body grammar G16) to the correct descent measure. Conventions: Read more
Source§

const SITE_BUDGET: usize = Self::SITE_COUNT

Ontology-level siteBudget: count of data sites only, excluding bookkeeping introduced by composition (coproduct tag sites, etc.). Equals SITE_COUNT for leaf shapes and for shapes whose composition introduces no bookkeeping (products, cartesian products). Strictly less than SITE_COUNT for coproduct shapes and any shape whose SITE_COUNT includes inherited bookkeeping. Introduced by the Product/Coproduct Completion Amendment §4a; defaults to SITE_COUNT so pre-amendment shape impls remain valid without edits.

Auto Trait Implementations§

§

impl<const TARGET_LABEL_BYTES: usize, const ENDPOINT_BYTES: usize, const TIME_PAIR_BYTES: usize, const SIG_LABEL_BYTES: usize, const COMMIT_LABEL_BYTES: usize> Freeze for RouteShape<TARGET_LABEL_BYTES, ENDPOINT_BYTES, TIME_PAIR_BYTES, SIG_LABEL_BYTES, COMMIT_LABEL_BYTES>

§

impl<const TARGET_LABEL_BYTES: usize, const ENDPOINT_BYTES: usize, const TIME_PAIR_BYTES: usize, const SIG_LABEL_BYTES: usize, const COMMIT_LABEL_BYTES: usize> RefUnwindSafe for RouteShape<TARGET_LABEL_BYTES, ENDPOINT_BYTES, TIME_PAIR_BYTES, SIG_LABEL_BYTES, COMMIT_LABEL_BYTES>

§

impl<const TARGET_LABEL_BYTES: usize, const ENDPOINT_BYTES: usize, const TIME_PAIR_BYTES: usize, const SIG_LABEL_BYTES: usize, const COMMIT_LABEL_BYTES: usize> Send for RouteShape<TARGET_LABEL_BYTES, ENDPOINT_BYTES, TIME_PAIR_BYTES, SIG_LABEL_BYTES, COMMIT_LABEL_BYTES>

§

impl<const TARGET_LABEL_BYTES: usize, const ENDPOINT_BYTES: usize, const TIME_PAIR_BYTES: usize, const SIG_LABEL_BYTES: usize, const COMMIT_LABEL_BYTES: usize> Sync for RouteShape<TARGET_LABEL_BYTES, ENDPOINT_BYTES, TIME_PAIR_BYTES, SIG_LABEL_BYTES, COMMIT_LABEL_BYTES>

§

impl<const TARGET_LABEL_BYTES: usize, const ENDPOINT_BYTES: usize, const TIME_PAIR_BYTES: usize, const SIG_LABEL_BYTES: usize, const COMMIT_LABEL_BYTES: usize> Unpin for RouteShape<TARGET_LABEL_BYTES, ENDPOINT_BYTES, TIME_PAIR_BYTES, SIG_LABEL_BYTES, COMMIT_LABEL_BYTES>

§

impl<const TARGET_LABEL_BYTES: usize, const ENDPOINT_BYTES: usize, const TIME_PAIR_BYTES: usize, const SIG_LABEL_BYTES: usize, const COMMIT_LABEL_BYTES: usize> UnsafeUnpin for RouteShape<TARGET_LABEL_BYTES, ENDPOINT_BYTES, TIME_PAIR_BYTES, SIG_LABEL_BYTES, COMMIT_LABEL_BYTES>

§

impl<const TARGET_LABEL_BYTES: usize, const ENDPOINT_BYTES: usize, const TIME_PAIR_BYTES: usize, const SIG_LABEL_BYTES: usize, const COMMIT_LABEL_BYTES: usize> UnwindSafe for RouteShape<TARGET_LABEL_BYTES, ENDPOINT_BYTES, TIME_PAIR_BYTES, SIG_LABEL_BYTES, COMMIT_LABEL_BYTES>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.