AppliedOperation#

One operation of a SchedulingChanges set that Project::apply accepted. You don't build it yourself. Read it from ApplyReport::applied.

Declaration#

#[derive(Clone, Debug, PartialEq, Eq)]
pub struct AppliedOperation {
    pub path: String,
}

With the serde feature, it also implements Serialize and Deserialize.

Fields#

Name Type Description
path String The accepted operation, written as {group}.{list}[{index}]. group is tasks, links, resources or assignments. list is add, update or remove. index is the entry's position in that list of the change set. Examples: tasks.update[0], links.add[2].

Serialization#

With the serde feature, an AppliedOperation serializes as:

{ "path": "tasks.update[0]" }

Example#

Update a task's duration and print the paths of the accepted operations.

use plen_core::{
    DateTime, Patch, Project, ProjectData, SchedulingChanges, SolveOptions, TaskData, TaskUpdate,
};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let monday = DateTime::from_ymd_hm(2026, 3, 2, 8, 0).ok_or("invalid date")?;

    let mut design = TaskData::new(1);
    design.start_date = Some(monday);
    design.duration = Some(2.0);

    let data = ProjectData {
        tasks: vec![design],
        ..Default::default()
    };

    let mut project = Project::default();
    project.solve(Some(data), &SolveOptions::default())?;

    let mut changes = SchedulingChanges::default();
    let mut update = TaskUpdate::new(1);
    update.duration = Patch::Value(3.0);
    changes.tasks.update.push(update);

    let report = project.apply(&changes)?;
    for applied in &report.applied {
        println!("applied: {}", applied.path); // applied: tasks.update[0]
    }
    Ok(())
}