Skip to main content

stage

Function stage 

Source
pub fn stage(
    cancelled: bool,
    superseded: bool,
    milestones: &[Option<String>],
    all_met: bool,
) -> IntentStage
Expand description

The stage of an intent from the facts it rests on. Pure: no index, no ledger.

use majordomus_cli::intent::{stage, IntentStage};
let st = |s: &str| Some(s.to_string());
assert_eq!(stage(false, false, &[None], true), IntentStage::Declared);
assert_eq!(stage(false, false, &[st("PLANNED")], true), IntentStage::Planned);
assert_eq!(stage(false, false, &[st("ACTIVE"), st("PLANNED")], true), IntentStage::Executing);
assert_eq!(stage(false, false, &[st("DONE")], false), IntentStage::Verifying);
assert_eq!(stage(false, false, &[st("DONE")], true), IntentStage::Satisfied);