Learning

Go Deeper

Read the Reference through Its Root

One complete Rust reference, with explicit boundaries.

Downloads

Download the complete Rust reference.

Start with the selected story, then follow its contracts into the data and operations.

pub type OpenWorkshop<P> = Workshop<Google<P>, WithoutPassword, CookieValid>;
pub type ConfirmedWorkshop<P> = Workshop<Google<P>, WithoutPassword, ConfirmedOnly>;
File Read for
src/contract.rs Root choices and successor relationships
src/model.rs Private states, actual resources and effects
tests/flows.rs Worked uses and observed policy differences
Registration and its two follow-ups Verify identity Admit registration Record account EntryConfirmation Session + owed confirmation Check the sessionand entry policy Deliver message↓Confirm contact

The example models one in-memory workshop. It demonstrates registration, both entry policies, confirmation and recovery of dropped handles.

Engineering Depth

This generic consumer follows the root contract:

fn register<S: WorkshopStories>(shop: &mut S, assertion: &str) -> (S::Session, S::Confirmation) {
    shop.signup(assertion.into())
        .verify()
        .unwrap()
        .admit()
        .unwrap()
        .record()
        .into_followups()
}

Here, unwrap() belongs to a known-valid fixture. An application must handle the declared refusal and availability outcomes.

The two follow-ups are exposed together:

pub trait RecordedRegistration: private::Stage + Sized {
    type Session;
    type Confirmation;
    fn into_followups(self) -> (Self::Session, Self::Confirmation);
}

The workshop keeps owed work independently of either returned handle. The entry policy is sealed; the identity adapter is an open trusted port. Both choices have specific purposes in this example.

This attempted shortcut is rejected by the compiler:

shop.signup("a".into()).record();

Submitted has no record() method. Verification and admission produce the required successor.

Your Reflection

Find one compile-time relationship, one runtime check and one limit of this model.

Worked Discussion

Verified: AdmitRegistration constrains the next capability. Entry still checks current expiry and revocation. Pending work survives dropped handles, but only while the in-memory workshop lives.

Navigation