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


# LoadProfileOptions

Options passed to [`Project::load_profile`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/project/project.md#load_profile>): a [`ProfileQuery`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/resources/profile-query.md>) and an optional expected baseline token. `LoadProfileOptions` has no `Default`. Build it from a query with `From<ProfileQuery>` (`query.into()`), or as a struct literal when `baseline_id` is set.

## Declaration

```rust
#[derive(Clone, Debug)]
pub struct LoadProfileOptions {
    pub query: ProfileQuery,
    pub baseline_id: Option<String>,
}

impl From<ProfileQuery> for LoadProfileOptions
```

## Fields

| Field | Type | Default | Description |
|---|---|---|---|
| `query` | [`ProfileQuery`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/resources/profile-query.md>) | required | Date range, resources, basis and task lists the profile covers. |
| `baseline_id` | `Option<String>` | `None` | Expected baseline token. `Some` makes the call fail with [`ProjectError::StaleBaseline`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/errors/project-error.md>) unless it names the current baseline. Take it from the latest [`ScheduleResult`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/results/schedule-result.md>)'s `baseline_id`. `None` skips the check. |

## Example

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

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

    let mut task = TaskData::new("a");
    task.start_date = Some(day(5)?);
    task.duration = Some(2.0);

    let data = ProjectData {
        tasks: vec![task],
        resources: vec![ResourceData { id: "r1".into(), capacity: None, calendar_id: None }],
        assignments: vec![AssignmentData {
            id: None,
            task: "a".into(),
            resource: "r1".into(),
            value: 1.0,
            offset: None,
            duration: None,
        }],
        ..Default::default()
    };

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

    let options = LoadProfileOptions {
        query: ProfileQuery::new(day(5)?, day(10)?),
        baseline_id: solved.baseline_id.clone(),
    };
    let profile = project.load_profile(&options)?;
    for resource in &profile.resources {
        for bucket in &resource.buckets {
            println!("{:?} {:?}: {} / {}", resource.resource, bucket.start, bucket.load, bucket.capacity);
        }
    }

    // Without a baseline check, convert the query directly.
    let _ = project.load_profile(&ProfileQuery::new(day(5)?, day(10)?).into())?;
    Ok(())
}
```

## Related

- [`Project::load_profile`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/project/project.md#load_profile>) - takes these options
- [`LoadProfile`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/resources/load-profile.md>) - what the call returns
- [`ProjectError`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/errors/project-error.md>) - holds the stale-baseline error a mismatched `baseline_id` causes
- [Resource Load](<https://docs.dhtmlx.com/planning-engine/rust/resources-and-assignment/resource-load.md#pinning-the-profile-to-a-baseline>) - pins a profile to a baseline token
