Skip to main content

Validated

Struct Validated 

Source
pub struct Validated<T, Phase = Runtime>
where Phase: ValidationPhase,
{ /* private fields */ }
Expand description

Proof that a value was produced by the conformance checker, not fabricated by Prism code. The inner value and _sealed field are private, so Validated<T> can only be constructed within this crate. v0.2.2 W13: parameterized by a Phase: ValidationPhase discriminator. Validated<T, CompileTime> was witnessed by validate_const() and is usable in const contexts. Validated<T, Runtime> (the default) was witnessed by validate(). A CompileTime witness is convertible to a Runtime witness via From.

§Examples

use uor_foundation::enforcement::{CompileUnitBuilder, ConstrainedTypeInput, Term};
use uor_foundation::{WittLevel, VerificationDomain};

// Validated<T> proves that a value passed conformance checking.
// You cannot construct one directly — only builder validate() methods
// and the minting boundary produce them.
let terms = [uor_foundation::pipeline::literal_u64(1, WittLevel::W8)];
let domains = [VerificationDomain::Enumerative];

let validated = CompileUnitBuilder::new()
    .root_term(&terms)
    .witt_level_ceiling(WittLevel::W8)
    .thermodynamic_budget(1024)
    .target_domains(&domains)
    .result_type::<ConstrainedTypeInput>()
    .validate()
    .expect("all fields set");

// Access the inner value through the proof wrapper:
let _compile_unit = validated.inner();

Implementations§

Source§

impl<T, Phase> Validated<T, Phase>

Source

pub const fn as_landauer(&self) -> ValidatedLandauerView<T, Phase>

Phase 16 — Landauer-cost view of self.

Source

pub const fn as_jacobian(&self) -> ValidatedJacobianView<T, Phase>

Phase 16 — Jacobian view of self.

Source

pub const fn as_carry_depth(&self) -> ValidatedCarryDepthView<T, Phase>

Phase 16 — carry-depth view of self.

Source

pub const fn as_derivation_depth( &self, ) -> ValidatedDerivationDepthView<T, Phase>

Phase 16 — derivation-depth view of self.

Source

pub const fn as_free_rank(&self) -> ValidatedFreeRankView<T, Phase>

Phase 16 — free-rank view of self.

Source§

impl<T, Phase> Validated<T, Phase>
where Phase: ValidationPhase,

Source

pub const fn inner(&self) -> &T

Returns a reference to the validated inner value.

Trait Implementations§

Source§

impl<T, Phase> Clone for Validated<T, Phase>
where T: Clone, Phase: Clone + ValidationPhase,

Source§

fn clone(&self) -> Validated<T, Phase>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T, Phase> Debug for Validated<T, Phase>
where T: Debug, Phase: Debug + ValidationPhase,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<T> Deref for Validated<T>
where T: OntologyTarget,

v0.2.1 Deref impl for Validated<T: OntologyTarget> so consumers can call certificate methods directly: cert.target_level() rather than cert.inner().target_level(). The bound T: OntologyTarget keeps the auto-deref scoped to foundation-produced types.

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &T

Dereferences the value.
Source§

impl<T> From<Validated<T, CompileTime>> for Validated<T>

v0.2.2 W13: a compile-time witness is usable wherever a runtime witness is required.

Source§

fn from(value: Validated<T, CompileTime>) -> Validated<T>

Converts to this type from the input type.
Source§

impl<T, Phase> PartialEq for Validated<T, Phase>
where T: PartialEq, Phase: PartialEq + ValidationPhase,

Source§

fn eq(&self, other: &Validated<T, Phase>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T, Phase> Eq for Validated<T, Phase>
where T: Eq, Phase: Eq + ValidationPhase,

Source§

impl<T, Phase> StructuralPartialEq for Validated<T, Phase>
where Phase: ValidationPhase,

Auto Trait Implementations§

§

impl<T, Phase> Freeze for Validated<T, Phase>
where T: Freeze,

§

impl<T, Phase> RefUnwindSafe for Validated<T, Phase>
where T: RefUnwindSafe, Phase: RefUnwindSafe,

§

impl<T, Phase> Send for Validated<T, Phase>
where T: Send, Phase: Send,

§

impl<T, Phase> Sync for Validated<T, Phase>
where T: Sync, Phase: Sync,

§

impl<T, Phase> Unpin for Validated<T, Phase>
where T: Unpin, Phase: Unpin,

§

impl<T, Phase> UnsafeUnpin for Validated<T, Phase>
where T: UnsafeUnpin,

§

impl<T, Phase> UnwindSafe for Validated<T, Phase>
where T: UnwindSafe, Phase: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.