ProfileTasks#

Selects which buckets of a load profile list their booked task ids. It's the type of ProfileQuery::tasks, and the choice fills LoadBucket::tasks. The default is ProfileTasks::None.

Declaration#

#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub enum ProfileTasks {
    #[default]
    None,
    Over,
    All,
}

Variants#

Variant Description
None Default. No bucket lists tasks: LoadBucket::tasks is None in every bucket.
Over Only overallocated buckets (load > capacity) list their tasks. Every other bucket gets Some with an empty list.
All Every bucket lists the tasks booked in it. A bucket with no bookings gets Some with an empty list.

Example#

use plen_core::{DateTime, ProfileQuery, ProfileTasks};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let from = DateTime::from_ymd_hm(2026, 8, 10, 0, 0).ok_or("invalid date")?;
    let to = DateTime::from_ymd_hm(2026, 8, 15, 0, 0).ok_or("invalid date")?;

    let mut query = ProfileQuery::new(from, to);
    assert_eq!(query.tasks, ProfileTasks::None);

    // List booked tasks only in overallocated buckets.
    query.tasks = ProfileTasks::Over;
    Ok(())
}