LinkUpdate#
A partial edit of one existing link: only the fields you set change, the rest keep their current values. Put it in SchedulingChanges::links.update (see SchedulingChanges) and pass the set to Project::apply, Project::preview or an evaluation candidate. Create one with LinkUpdate::new, then set the fields to change.
Declaration#
Associated functions#
new#
Creates an update for the link with this id. Every other field is Patch::Missing, so the update changes nothing until a field is set.
Parameters
| Name | Type | Description |
|---|---|---|
id |
impl Into<Id> |
Id of the link to edit. Accepts &str, String, f64 and i32. |
Returns a LinkUpdate with only id set.
Fields#
Each editable field is a Patch; the table shows what Patch::Null does to each. The fields themselves mean the same as on LinkData.
| Field | Type | Patch::Null |
|---|---|---|
id |
Id |
not a patch. Selects the link to edit. |
source |
Patch<Id> |
rejected: a link always has a source. |
target |
Patch<Id> |
rejected: a link always has a target. |
link_type |
Patch<LinkType> |
resets to LinkType::Fs. |
lag |
Patch<f64> |
resets to 0.0. |
lag_unit |
Patch<TimeUnit> |
clears the unit, so lag is read in config.duration_unit. |
id#
pub id: Id
Id of an existing link. The update edits that link and can't change its id.
source, target#
pub source:
pub target:
Value(id) moves that end of the link to another task. If the new task doesn't exist or is unscheduled, the update is still applied, but the link is dropped from scheduling and its id is listed in ChangeEffects::dropped_links.
link_type#
pub link_type:
Which end of source drives which end of target.
lag#
pub lag:
Working time between the two ends, in the link's lag unit. Negative values are allowed. The value must be finite.
lag_unit#
pub lag_unit:
Unit of lag for this link only.
Errors#
An invalid update is listed in ApplyReport::rejected as a RejectedOperation with path links.update[i], and the link stays as it was. An update is rejected when:
idnames no link in the project:unknown link idsourceortargetisPatch::Null:required field cannot be nulllagisNaNor infinite
Example#
Turn link "a" into a start-to-start link with a two-hour lag and leave its tasks as they are:
use ;
Related#
LinkData- the record an update editsLinkAdd- adds a new link insteadPatch- the type of every editable field- Data Updates - shows link updates in a change set
- Links, constraints and summaries - explains link types and lag