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 |
The example models one in-memory workshop. It demonstrates registration, both entry policies, confirmation and recovery of dropped handles. Its identity checks and delivery are fixtures. It does not provide real OAuth, email delivery or recovery after process loss.
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.
Notes are browser-local. Export a copy to keep them; they are not submitted or judged.
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.