pub struct Bytes<const N: usize>;Expand description
Bytes<N> — byte-buffer admission intent of width N.
Structurally identical to FixedSites<N> and content-address-
identical at equal N (closure rule: same constraint declaration ⇒
same IRI ⇒ same UOR address). Use Bytes<N> when the unit’s intent
is “this is a byte sequence” and FixedSites<N> when the intent is
“this is a generic site container of width N”; the Rust type name
distinguishes intent at the call site, the IRI does not.
§See also
crate::std_types— the family contract and IRI namespace- Wiki: 05 Building Block View § Whitebox
prism - AGENTS.md § 11
§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
§Behavior
use prism::pipeline::ConstrainedTypeShape;
use prism::std_types::{Bytes, FixedSites};
// Same SITE_COUNT and same IRI as FixedSites<N> per closure.
assert_eq!(<Bytes<32> as ConstrainedTypeShape>::SITE_COUNT, 32);
assert_eq!(
<Bytes<32> as ConstrainedTypeShape>::IRI,
"https://uor.foundation/type/ConstrainedType",
);
assert_eq!(
<Bytes<32> as ConstrainedTypeShape>::IRI,
<FixedSites<32> as ConstrainedTypeShape>::IRI,
);Trait Implementations§
Source§impl<const N: usize> ConstrainedTypeShape for Bytes<N>
impl<const N: usize> ConstrainedTypeShape for Bytes<N>
Source§const IRI: &'static str = "https://uor.foundation/type/ConstrainedType"
const IRI: &'static str = "https://uor.foundation/type/ConstrainedType"
IRI of the ontology
type:ConstrainedType instance this shape represents.Source§const SITE_COUNT: usize = N
const SITE_COUNT: usize = N
Number of sites (fields) this constrained type carries.
Source§const CONSTRAINTS: &'static [ConstraintRef]
const CONSTRAINTS: &'static [ConstraintRef]
Per-site constraint list. Empty means unconstrained.
Source§const CYCLE_SIZE: u64
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 moreSource§const SITE_BUDGET: usize = Self::SITE_COUNT
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 N: usize> Freeze for Bytes<N>
impl<const N: usize> RefUnwindSafe for Bytes<N>
impl<const N: usize> Send for Bytes<N>
impl<const N: usize> Sync for Bytes<N>
impl<const N: usize> Unpin for Bytes<N>
impl<const N: usize> UnsafeUnpin for Bytes<N>
impl<const N: usize> UnwindSafe for Bytes<N>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more