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


# LevelingOrder

Selects how leveling picks the task that moves when several tasks compete for an overallocated resource. It's the type of [`LevelingOptions::order`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/resources/leveling-options.md#order>). The default is `LevelingOrder::Standard`.

## Declaration

```rust
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub enum LevelingOrder {
    Id,
    #[default]
    Standard,
    Priority,
}
```

With the `serde` feature, the variants serialize as `"id"`, `"standard"` and `"priority"`.

## Variants

| Variant | Description |
|---|---|
| `Id` | A task already running stays where possible; among the rest, the task later in input order moves. |
| `Standard` | Default. A task already running stays where possible, then the MS Project standard chain decides: dependency, total slack, start date, `priority`, constraints, input order. |
| `Priority` | Lower [`TaskData::priority`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/data/task-data.md#priority>) moves first, even when that task is already running. Equal priorities fall through to `Standard`. |

Every order ends with the same tie-break, so the result is deterministic. For the full rules, see [Leveling resources](<https://docs.dhtmlx.com/planning-engine/rust/resources-and-assignment/leveling-resources.md>).

## Example

```rust
use plen_core::{LevelingOptions, LevelingOrder};

fn main() {
    let options = LevelingOptions {
        order: LevelingOrder::Priority,
        ..LevelingOptions::default()
    };
    assert_eq!(LevelingOptions::default().order, LevelingOrder::Standard);
    assert_eq!(options.order, LevelingOrder::Priority);
}
```

## Related

- [`LevelingOptions`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/resources/leveling-options.md>) - holds the order as its `order` field
- [`LevelingStep`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/resources/leveling-step.md>) - the other setting for how a picked task moves
- [`TaskData`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/data/task-data.md>) - carries the `priority` that `Priority` order reads
- [Leveling Resources](<https://docs.dhtmlx.com/planning-engine/rust/resources-and-assignment/leveling-resources.md#selection-order>) - shows how each order picks the task to move
