ResourceUpdate#
An edit to one existing resource in a live project. It goes into resources.update of SchedulingChanges, which Project::apply takes. Create it with ResourceUpdate::new and set only the fields to change. To add a resource, use ResourceData in resources.add instead.
Declaration#
Constructors#
ResourceUpdate::new#
Creates an update for the resource id with every field set to Patch::Missing, so nothing changes until a field is set.
Parameters
| Name | Type | Description |
|---|---|---|
id |
impl Into<Id> |
Id of the resource to edit. Accepts a string or a number. |
Returns a ResourceUpdate that leaves the resource unchanged.
Fields#
Each Patch field follows the Patch rules: Missing leaves the field as is, Null clears it, Value sets it. The new value is validated like the matching ResourceData field.
id#
pub id: Id
Id of the resource to edit. It must name a resource in the project.
capacity#
pub capacity:
New ResourceData::capacity. Null clears it, so the resource takes the default capacity again.
Default: Patch::Missing.
calendar_id#
pub calendar_id:
New ResourceData::calendar_id. Null clears it, so the resource has no calendar of its own. The id must name an existing calendar; Project::apply can't add calendars.
When assignments work on resource calendars, a task whose working calendars change keeps its start and duration, and its end is derived again. See Resources and assignments.
Default: Patch::Missing.
Errors#
Project::apply rejects the operation, and lists it under its path (such as resources.update[0]) in ApplyReport::rejected, when:
idnames no resource in the project (unknown resource id)- the new
capacityorcalendar_idfailsResourceDatavalidation
A rejected update leaves the resource unchanged.
Example#
use ;
Related#
ResourceData- the record an update editsPatch- the type of every editable fieldApplyReport- reports whether the update was applied- Data Updates - shows resource updates in a change set