Skip to main content

realize

Function realize 

Source
pub fn realize(
    intents: &Intents,
    plan: &Plan,
    units: Vec<IntentWorkUnit>,
) -> IntentRealization
Expand description

Join every unit of work to every intent. Pure: the records are already read.

use majordomus_cli::intent::Intents;
use majordomus_cli::intent_realization::{realize, IntentWorkKind, IntentWorkUnit};
let mut live = IntentWorkUnit::new(IntentWorkKind::Task, "t-1");
live.outcome = "active".into();
let r = realize(&Intents { intents: vec![], findings: vec![] }, &plan, vec![live]);
// live work that serves no intent is an orphan, and is named
assert_eq!(r.orphans, 1);
assert_eq!(r.findings[0].code, "work_serves_no_intent");