pub struct FixedSites<const N: usize>;Expand description
FixedSites<N> — admit exactly N sites, unconstrained per-site.
The simplest non-trivial standard-type-library citizen: a generic
ConstrainedTypeShape that fixes a site count and imposes no
per-site constraint. It is the parametric building block under any
downstream shape that wants “this many sites, my own grounding
admission decides what each site contains” — for example, a 32-byte
hash output (32 sites at WittLevel::W8), an 80-byte Bitcoin block
header (80 sites at WittLevel::W8), or a 16-element
integer-vector at WittLevel::W64.
At any instantiation, <FixedSites<N> as ConstrainedTypeShape>::SITE_COUNT == N
and <FixedSites<N> as ConstrainedTypeShape>::CONSTRAINTS is the empty
slice (foundation reads “empty CONSTRAINTS” as “unconstrained” per
the trait’s normative documentation). The IRI is the foundation’s
ConstrainedType class IRI — shared across every empty-constraint
stdlib type per ADR-017 and the closure rule documented
in this module’s header — so instance identity flows entirely
through (SITE_COUNT, CONSTRAINTS).
§See also
§Constraints
- TC-01 — admission is a compile-time activity;
SITE_COUNTandCONSTRAINTSareconst-evaluable - TC-04 — bilateral compile-time enforcement: a downstream
author who consumes
FixedSites<N>cannot violate the contract without the toolchain rejecting their program - ADR-013 — closure under
uor-foundation: the body uses only foundation vocabulary (ConstrainedTypeShape,ConstraintRef) - ADR-017 — content-addressed identity: the
(IRI, SITE_COUNT, CONSTRAINTS)triple deterministically encodes each instantiation
§Behavior
// Given: a fixed-32-sites shape
// When: its trait constants are read
// Then: SITE_COUNT reflects N and CONSTRAINTS is empty
use prism::pipeline::ConstrainedTypeShape;
use prism::std_types::FixedSites;
assert_eq!(<FixedSites<32> as ConstrainedTypeShape>::SITE_COUNT, 32);
assert!(<FixedSites<32> as ConstrainedTypeShape>::CONSTRAINTS.is_empty());
assert_eq!(
<FixedSites<32> as ConstrainedTypeShape>::IRI,
"https://uor.foundation/type/ConstrainedType",
);
// And: a different N produces a distinct content-address — same
// IRI, different SITE_COUNT — so the (IRI, SITE_COUNT, CONSTRAINTS)
// triple distinguishes the two instantiations.
assert_eq!(<FixedSites<80> as ConstrainedTypeShape>::SITE_COUNT, 80);
assert_eq!(
<FixedSites<80> as ConstrainedTypeShape>::IRI,
<FixedSites<32> as ConstrainedTypeShape>::IRI,
);Trait Implementations§
Source§impl<const N: usize> ConstrainedTypeShape for FixedSites<N>
impl<const N: usize> ConstrainedTypeShape for FixedSites<N>
Source§const IRI: &'static str = "https://uor.foundation/type/ConstrainedType"
const IRI: &'static str = "https://uor.foundation/type/ConstrainedType"
type:ConstrainedType instance this shape represents.Source§const SITE_COUNT: usize = N
const SITE_COUNT: usize = N
Source§const CONSTRAINTS: &'static [ConstraintRef]
const CONSTRAINTS: &'static [ConstraintRef]
Source§const CYCLE_SIZE: u64
const CYCLE_SIZE: u64
prism_model! macro to lower first_admit
(closure-body grammar G16) to the correct descent measure.
Conventions: Read moreSource§const SITE_BUDGET: usize = Self::SITE_COUNT
const SITE_BUDGET: usize = Self::SITE_COUNT
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.