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


# API reference

The Rust API of Planning Engine ships as two crates. `plen-core` schedules, edits, levels and scores projects. `plen-assign` is an optional skill layer that turns workers and skill requirements into slots for auto-assignment.

## How the API is organized

The first level of this reference is the crate:

- [core](<https://docs.dhtmlx.com/planning-engine/rust/api/core/overview.md>) - `plen-core`, imported as `plen_core`.
- [assign](<https://docs.dhtmlx.com/planning-engine/rust/api/assign/overview.md>) - `plen-assign`, imported as `plen_assign`. It depends on `plen-core`. Its [`slots`](<https://docs.dhtmlx.com/planning-engine/rust/api/assign/slots.md>) function returns the slot list that [`Project::suggest_assignments`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/project/project.md#suggest_assignments>) takes.

```bash
cargo add plen-core
cargo add plen-assign
```

Add `plen-assign` only for skill-based auto-assignment.

```rust
use plen_core::{Project, ProjectData, ProjectOptions, SolveOptions};
use plen_assign::{slots, Pool, Requirement};
```

Every call in both crates is synchronous. Fallible calls return `Result`. See [Error handling](<https://docs.dhtmlx.com/planning-engine/rust/error-handling.md>) for which failures are errors and which are data in the result.

## Calls by task

| To | Call | Options | Returns |
|---|---|---|---|
| Schedule a snapshot once | [`schedule`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/project/schedule.md>) | [`SolveOptions`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/project/solve-options.md>) | [`ScheduleResult`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/results/schedule-result.md>) |
| Load a live project or reschedule its edits | [`Project::solve`](<https://docs.dhtmlx.com/planning-engine/rust/api/project-solve.md>) | [`SolveOptions`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/project/solve-options.md>) | [`ScheduleResult`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/results/schedule-result.md>) |
| See what an edit would do | [`Project::preview`](<https://docs.dhtmlx.com/planning-engine/rust/api/project-preview.md>) | [`PreviewOptions`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/project/preview-options.md>) | [`ScheduleResult`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/results/schedule-result.md>) |
| Get critical path and slack without scheduling | [`Project::analyze`](<https://docs.dhtmlx.com/planning-engine/rust/api/project-analyze.md>) | [`AnalyzeOptions`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/project/analyze-options.md>) | [`ScheduleResult`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/results/schedule-result.md>) |
| Commit an edit | [`Project::apply`](<https://docs.dhtmlx.com/planning-engine/rust/api/project-apply.md>) | [`SchedulingChanges`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/changes/scheduling-changes.md>) | [`ApplyReport`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/changes/apply-report.md>) |
| Resolve resource overallocation | [`Project::level`](<https://docs.dhtmlx.com/planning-engine/rust/api/project-level.md>) | [`LevelingOptions`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/resources/leveling-options.md>) | [`LevelingResult`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/resources/leveling-result.md>) |
| Read resource load per day or week | [`Project::load_profile`](<https://docs.dhtmlx.com/planning-engine/rust/api/project-load-profile.md>) | [`LoadProfileOptions`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/resources/load-profile-options.md>) | [`LoadProfile`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/resources/load-profile.md>) |
| Compare alternative edits | [`Project::evaluate`](<https://docs.dhtmlx.com/planning-engine/rust/api/project-evaluate.md>) | [`EvaluateOptions`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/evaluate/evaluate-options.md>) | [`EvaluateResult`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/evaluate/evaluate-result.md>) |
| Pick resources for open positions | [`Project::suggest_assignments`](<https://docs.dhtmlx.com/planning-engine/rust/api/project-suggest-assignments.md>) | [`SuggestOptions`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/suggest/suggest-options.md>) | [`SuggestResult`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/suggest/suggest-result.md>) |
| Read tasks, resources and assignments for building slots | [`Project::roster`](<https://docs.dhtmlx.com/planning-engine/rust/api/project-roster.md>) | - | [`Roster`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/suggest/roster.md>) |
| Build slots from skills and requirements | [`plen_assign::slots`](<https://docs.dhtmlx.com/planning-engine/rust/api/assign/slots.md>) | [`Pool`](<https://docs.dhtmlx.com/planning-engine/rust/api/assign/pool.md>), [`Requirement`](<https://docs.dhtmlx.com/planning-engine/rust/api/assign/requirement.md>) | `Vec<`[`Slot`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/suggest/slot.md>)`>` |

`preview`, `load_profile`, `evaluate`, `suggest_assignments` and `roster` need a solved project. The full type with constructors and `clone` is on the [`Project`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/project/project.md>) page.
