pub enum Transition {
Start,
Verify,
Done,
}Expand description
One lifecycle move.
Three, not four: evidence appends a record rather than moving an issue, and it belongs
with the record it proves rather than with the moves it unblocks.
use majordomus_cli::plan::Transition;
// The wire spelling is the one a caller types on the command line.
let t: Transition = serde_json::from_str("\"done\"").unwrap();
assert_eq!(t, Transition::Done);
assert_eq!(serde_json::to_string(&Transition::Start).unwrap(), "\"start\"");
// Each move owns the field it stamps and the event it records; nothing else decides
// either, so a new move cannot be added without saying both.
for (t, field, event) in [
(Transition::Start, "started_at", "plan_start"),
(Transition::Verify, "verified_at", "plan_verify"),
(Transition::Done, "completed_at", "plan_done"),
] {
assert_eq!(t.field(), field);
assert_eq!(t.event(), event);
}Variants§
Start
Execution began. Refused unless the issue is READY.
Verify
Implementation is complete and the evidence is still outstanding.
Done
Complete. Refused while anything it waits on is unfinished, or while any evidence its own record requires is absent.
Implementations§
Source§impl Transition
impl Transition
Sourcepub fn field(self) -> &'static str
pub fn field(self) -> &'static str
The record field this move stamps, and the only field it writes besides updated_at.
The status is never stored: an issue records what happened to it and the status follows. So a move owns a timestamp, not a state, and this names which one.
use majordomus_cli::plan::Transition;
assert_eq!(Transition::Start.field(), "started_at");
assert_eq!(Transition::Done.field(), "completed_at");Sourcepub fn event(self) -> &'static str
pub fn event(self) -> &'static str
The event share/events.yaml declares for it.
The four plan events are spelled with an underscore rather than the dot the rest of the vocabulary uses. They are registered as written, because the ledger of this repository already holds dozens of them and a rename would orphan every one.
use majordomus_cli::plan::Transition;
assert_eq!(Transition::Verify.event(), "plan_verify");
assert!(Transition::Done.event().starts_with("plan_"));Sourcepub fn seal_field(self) -> &'static str
pub fn seal_field(self) -> &'static str
The record field that carries this move’s seal, beside the stamp it proves.
use majordomus_cli::plan::Transition;
assert_eq!(Transition::Start.seal_field(), "started_event");
assert_eq!(Transition::Verify.seal_field(), "verified_event");
assert_eq!(Transition::Done.seal_field(), "completed_event");Trait Implementations§
Source§impl Clone for Transition
impl Clone for Transition
Source§fn clone(&self) -> Transition
fn clone(&self) -> Transition
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for Transition
Source§impl Debug for Transition
impl Debug for Transition
Source§impl<'de> Deserialize<'de> for Transition
impl<'de> Deserialize<'de> for Transition
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Transition
Source§impl JsonSchema for Transition
impl JsonSchema for Transition
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for Transition
impl PartialEq for Transition
Source§fn eq(&self, other: &Transition) -> bool
fn eq(&self, other: &Transition) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for Transition
impl Serialize for Transition
impl StructuralPartialEq for Transition
Auto Trait Implementations§
impl Freeze for Transition
impl RefUnwindSafe for Transition
impl Send for Transition
impl Sync for Transition
impl Unpin for Transition
impl UnsafeUnpin for Transition
impl UnwindSafe for Transition
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.