[Canonical page](<https://docs.dhtmlx.com/planning-engine/rust/api/core/resources/resource-overallocation/>)
[Full documentation index](<https://docs.dhtmlx.com/planning-engine/llms.txt>)


# ResourceOverallocation

The overallocated periods of one resource. You get it in [`ScheduleResult::overallocations`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/results/schedule-result.md#overallocations>), including the one in [`LevelingResult::schedule`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/resources/leveling-result.md>).

The list holds one entry per overallocated resource. A resource whose load never exceeds its capacity has no entry, so `windows` is never empty.

## Declaration

```rust
#[derive(Clone, Debug, PartialEq)]
pub struct ResourceOverallocation {
    pub resource: Id,
    pub windows: Vec<OverallocationWindow>,
}
```

With the `serde` feature, `ResourceOverallocation` implements `Serialize` and `Deserialize`. See [Serialize results to JSON](<https://docs.dhtmlx.com/planning-engine/rust/how-to/serialize-results-to-json.md>).

## Fields

| Field | Type | Description |
|---|---|---|
| `resource` | [`Id`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/data/id.md>) | Id of the resource, as given in [`ResourceData::id`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/data/resource-data.md>). |
| `windows` | `Vec<`[`OverallocationWindow`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/resources/overallocation-window.md>)`>` | The resource's overallocated periods: the edges, capacity, peak load, overload and contending tasks of each. |

## Example

Two one-day tasks on the same day, each booking the full capacity of one resource:

```rust
use plen_core::{
    schedule, AssignmentData, DateTime, ProjectData, ResourceData, SolveOptions, TaskData,
};

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

    let mut design = TaskData::new("design");
    design.start_date = Some(monday);
    design.duration = Some(1.0);

    let mut review = TaskData::new("review");
    review.start_date = Some(monday);
    review.duration = Some(1.0);

    let assign = |task: &str| AssignmentData {
        id: None,
        task: task.into(),
        resource: "anna".into(),
        value: 1.0,
        offset: None,
        duration: None,
    };

    let data = ProjectData {
        tasks: vec![design, review],
        resources: vec![ResourceData {
            id: "anna".into(),
            capacity: Some(1.0),
            calendar_id: None,
        }],
        assignments: vec![assign("design"), assign("review")],
        ..Default::default()
    };

    let result = schedule(data, &SolveOptions::default())?;

    for entry in result.overallocations.iter().flatten() {
        for window in &entry.windows {
            println!(
                "{}: {} -> {}, peak {} of {}, tasks {:?}",
                entry.resource, window.from, window.to, window.peak, window.capacity, window.tasks
            );
        }
    }
    Ok(())
}
```

## Related

- [`ScheduleResult`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/results/schedule-result.md#overallocations>) - holds the list of overallocated resources
- [`OverallocationWindow`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/resources/overallocation-window.md>) - one overallocated period of the resource
- [`LevelingResult`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/resources/leveling-result.md>) - its schedule lists what leveling left unresolved
- [Resources and assignments](<https://docs.dhtmlx.com/planning-engine/rust/resources-and-assignment/resources-and-assignments.md>) - finds overallocated resources after scheduling
- [Leveling Resources](<https://docs.dhtmlx.com/planning-engine/rust/resources-and-assignment/leveling-resources.md>) - resolves the overallocation by leveling
