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


# AssignTarget

A category of slot that [`Project::suggest_assignments`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/project/project.md#suggest_assignments>) acts on. Each slot falls into exactly one category, judged from its current resource in the accepted state. List the categories to act on in [`SuggestOptions::targets`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/suggest/suggest-options.md>), in any combination, each at most once.

## Declaration

```rust
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum AssignTarget {
    Empty,
    Broken,
    Valid,
}
```

## Variants

| Variant | Description |
|---|---|
| `Empty` | The slot has no assignment. Targeting it fills the slot in pass 0. |
| `Broken` | The slot's resource isn't in the slot's [`allowed`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/suggest/slot.md>) list. Targeting it repairs the slot in pass 0 with the cheapest candidate, whatever keeping the current resource would cost. |
| `Valid` | The slot's resource is in `allowed`. Targeting it rebalances the slot in passes `1..=passes`. The resource changes only on a strict improvement. |

For the default and the report-only setting, see [`SuggestOptions::targets`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/suggest/suggest-options.md>). For how the passes run, see [Suggesting assignments](<https://docs.dhtmlx.com/planning-engine/rust/resources-and-assignment/suggesting-assignments.md>).

## Example

```rust
use plen_core::{AssignTarget, SuggestOptions};

fn main() {
    // Fill empty slots, repair broken ones, and rebalance the rest.
    let options = SuggestOptions {
        targets: vec![AssignTarget::Empty, AssignTarget::Broken, AssignTarget::Valid],
        ..Default::default()
    };
    assert_eq!(options.targets.len(), 3);

    // Report only: no assignment changes.
    let check = SuggestOptions {
        targets: vec![],
        ..Default::default()
    };
    assert!(check.targets.is_empty());
}
```

## Related

- [`SuggestOptions`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/suggest/suggest-options.md>) - holds the list of targeted categories in `targets`
- [`Slot`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/suggest/slot.md>) - the input whose state decides its category
- [`SuggestResult`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/suggest/suggest-result.md>) - reports which targeted slots stayed unfilled or invalid
- [Suggesting assignments](<https://docs.dhtmlx.com/planning-engine/rust/resources-and-assignment/suggesting-assignments.md>) - shows filling, rebalancing and repairing with each target
