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


# RosterAssignment

One active assignment of the accepted state, reduced to its id, task and resource. You don't build it yourself. It's an entry of [`Roster::assignments`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/suggest/roster.md>), which [`Project::roster`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/project/project.md#roster>) returns.

## Declaration

```rust
#[derive(Clone, Debug, PartialEq)]
pub struct RosterAssignment {
    pub id: Id,
    pub task: Id,
    pub resource: Id,
}
```

`RosterAssignment` doesn't implement `Default` and has no `serde` support.

## Fields

| Field | Type | Description |
|---|---|---|
| `id` | [`Id`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/data/id.md>) | Id of the assignment |
| `task` | [`Id`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/data/id.md>) | Task the assignment is on |
| `resource` | [`Id`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/data/id.md>) | Resource the assignment books |

The assignment's units, offset and duration aren't included. Read them from the [`AssignmentData`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/data/assignment-data.md>) you passed in.

## Example

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

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let monday = DateTime::from_ymd_hm(2026, 8, 10, 8, 0).ok_or("invalid date")?;
    let data = ProjectData {
        tasks: vec![TaskData { start_date: Some(monday), duration: Some(2.0), ..TaskData::new(1) }],
        resources: vec![ResourceData { id: "dev1".into(), capacity: None, calendar_id: None }],
        assignments: vec![AssignmentData {
            id: Some("a1".into()),
            task: 1.into(),
            resource: "dev1".into(),
            value: 1.0,
            offset: None,
            duration: None,
        }],
        ..Default::default()
    };

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

    for a in &project.roster()?.assignments {
        println!("{:?}: {:?} on {:?}", a.id, a.resource, a.task);
    }
    Ok(())
}
```

## Related

- [`Roster`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/suggest/roster.md>) - the container that lists these entries
- [`Project::roster`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/project/project.md#roster>) - returns the roster with these entries
- [`AssignmentData`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/data/assignment-data.md>) - the input record each entry is reduced from
- [`Slot`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/suggest/slot.md>) - binds to an existing assignment by its id
