Skip to main content

WfNetConst

Struct WfNetConst 

Source
pub struct WfNetConst<const SOUNDNESS: SoundnessState> { /* private fields */ }
Expand description

A WF-net with soundness state encoded as a const generic parameter.

The SOUNDNESS parameter tracks whether soundness is unknown, claimed, or witnessed. Crucially, WfNetConst<{SoundnessState::Witnessed}> is only constructible via WfNetConst::witness_soundness, which requires a SoundnessProof — a type that is itself only constructible inside this module or via the wasm4pm graduation bridge.

Direct struct-literal construction fails because _seal is a private field.

use wasm4pm_compat::petri::{WfNetConst, SoundnessProof};
use wasm4pm_compat::law::SoundnessState;

// Build an unknown-soundness net, then claim it:
let unknown = WfNetConst::<{ SoundnessState::Unknown }>::new();
let claimed = unknown.claim_sound();
// To reach Witnessed, you would call claimed.witness_soundness(proof)
// where proof is only producible by the wasm4pm engine or this module.
use wasm4pm_compat::petri::WfNetConst;
use wasm4pm_compat::law::SoundnessState;
// ERROR: _seal is a private field; direct forged construction is impossible.
let forged: WfNetConst<{ SoundnessState::Witnessed }> = WfNetConst {
    _seal: todo!(),
};

Implementations§

Source§

impl WfNetConst<{ SoundnessState::Unknown }>

Source

pub fn new() -> Self

Construct a WfNetConst in the initial Unknown soundness state.

use wasm4pm_compat::petri::WfNetConst;
use wasm4pm_compat::law::SoundnessState;
let _wf = WfNetConst::<{ SoundnessState::Unknown }>::new();
Source

pub fn claim_sound(self) -> WfNetConst<{ SoundnessState::Claimed }>

Advance to Claimed soundness — a type-level re-tagging only.

use wasm4pm_compat::petri::WfNetConst;
use wasm4pm_compat::law::SoundnessState;
let claimed: WfNetConst<{ SoundnessState::Claimed }> =
    WfNetConst::<{ SoundnessState::Unknown }>::new().claim_sound();
Source§

impl WfNetConst<{ SoundnessState::Claimed }>

Source

pub fn witness_soundness( self, _proof: SoundnessProof, ) -> WfNetConst<{ SoundnessState::Witnessed }>

Advance a claimed WF-net to Witnessed — requires a SoundnessProof.

The SoundnessProof is only constructible inside this module or by the wasm4pm graduation bridge. This is the sanctioned, non-forgeable path to SoundnessState::Witnessed.

// Conceptual: the wasm4pm bridge supplies the proof after verifying soundness.
let witnessed = claimed.witness_soundness(proof_from_wasm4pm);

Trait Implementations§

Source§

impl Default for WfNetConst<{ SoundnessState::Unknown }>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl WfNetQuery for WfNetConst<{ SoundnessState::Claimed }>

Source§

fn soundness_state(&self) -> SoundnessState

The soundness state of this WF-net as a runtime value.
Source§

impl WfNetQuery for WfNetConst<{ SoundnessState::Unknown }>

Source§

fn soundness_state(&self) -> SoundnessState

The soundness state of this WF-net as a runtime value.
Source§

impl WfNetQuery for WfNetConst<{ SoundnessState::Witnessed }>

Source§

fn soundness_state(&self) -> SoundnessState

The soundness state of this WF-net as a runtime value.

Auto Trait Implementations§

§

impl<const SOUNDNESS: SoundnessState> Freeze for WfNetConst<SOUNDNESS>

§

impl<const SOUNDNESS: SoundnessState> RefUnwindSafe for WfNetConst<SOUNDNESS>

§

impl<const SOUNDNESS: SoundnessState> Send for WfNetConst<SOUNDNESS>

§

impl<const SOUNDNESS: SoundnessState> Sync for WfNetConst<SOUNDNESS>

§

impl<const SOUNDNESS: SoundnessState> Unpin for WfNetConst<SOUNDNESS>

§

impl<const SOUNDNESS: SoundnessState> UnsafeUnpin for WfNetConst<SOUNDNESS>

§

impl<const SOUNDNESS: SoundnessState> UnwindSafe for WfNetConst<SOUNDNESS>

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> EvidenceKind for T

Source§

default fn kind_label(&self) -> &'static str

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, 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.