CalendarMode#

Selects which calendars place a task's work: the calendars of the assigned resources, or task calendars only. It's the type of SchedulingConfig::calendar_mode. The default is CalendarMode::Resource.

With the serde feature, CalendarMode implements Serialize and Deserialize. Variants serialize in kebab-case: "resource", "task", "task-inherited".

Declaration#

#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum CalendarMode {
    #[default]
    Resource,
    Task,
    TaskInherited,
}

Variants#

Variant Description
Resource Default. Each assignment works on its resource's calendar intersected with the task's calendar. A task with several assignment calendars spans all of its assignments.
Task Task calendars only. Resource calendars are ignored. This is the dhtmlxGantt model.
TaskInherited Task calendars only, as in Task. A task without its own calendar uses the calendar of the nearest ancestor that has one.

Only TaskInherited inherits calendars from parent tasks. For how the calendars combine, see Working-time calendars.

Methods#

task_only#

pub fn task_only(self) -> bool

Returns true when resource calendars aren't used: Task and TaskInherited.

inherits#

pub fn inherits(self) -> bool

Returns true when tasks inherit their parent's calendar: TaskInherited only.

Example#

use plen_core::{CalendarMode, ProjectData, SchedulingConfig};

fn main() {
    let data = ProjectData {
        config: SchedulingConfig {
            calendar_mode: CalendarMode::TaskInherited,
            ..Default::default()
        },
        ..Default::default()
    };

    assert!(data.config.calendar_mode.task_only());
    assert!(data.config.calendar_mode.inherits());
    assert_eq!(CalendarMode::default(), CalendarMode::Resource);
}