in rust you can do this:
struct PLANNED; struct INPROGRESS; struct ABOARTED; struct COMPLETED; struct Mission<State> { detail: String, _marker: std::marker::PhantomData<State>, } impl<T> Mission<T> { fn new(detail: &str) -> Mission<PLANNED> { Mission { detail: detail.to_string(), _marker: std::marker::PhantomData, } } } impl Mission<PLANNED> { fn start(self) -> Mission<INPROGRESS> { Mission { detail: self.detail, _marker: std::marker::PhantomData, } } } impl Mission<INPROGRESS> { fn abort(self) -> Mission<ABOARTED> { Mission { detail: self.detail, _marker: std::marker::PhantomData, } } fn completed(self) -> Mission<COMPLETED> { Mission { detail: self.detail, _marker: std::marker::PhantomData, } } } impl Mission<COMPLETED> { fn requestReimbursement(self) { // ... } } if you call requestReimbursement by MissionMission<PLANNED> or some other non-MissionMission<COMPLETED> type, which will can't be compliledcompiled.