pub struct EntityRef {
pub type_name: String,
pub display: String,
pub planning_id: Option<String>,
}Expand description
An entity involved in a constraint match, as constraint analysis reports
it: the entity’s type name, its Debug rendering and, when its type has a
#[planning_id], its planning id, all taken when the match is explained.
It holds no copy of the entity, so explaining a match requires only
Debug on the entity type.
Fields§
§type_name: StringType name of the entity (e.g., “Shift”, “Employee”).
display: StringString representation for display. It is a rendering, not an
identifier: look records up by planning_id.
planning_id: Option<String>The entity’s planning id, rendered as a string: the id’s Display
output when its type implements Display (7, shift-7), otherwise
its Debug output (ShiftId(7)). Equal ids render equally, so it is
a lookup key for the record within its type.
Set for entities streamed from a planning model collection whose type
has a #[planning_id] field (#[planning_entity], #[problem_fact]);
None for every other entity, including plain values streamed through
a hand-built source.
Implementations§
Source§impl EntityRef
impl EntityRef
Sourcepub fn new<T: Debug + ?Sized>(entity: &T) -> Self
pub fn new<T: Debug + ?Sized>(entity: &T) -> Self
Describes entity by its type name and Debug rendering, with no
planning id.
Sourcepub fn with_planning_id(self, planning_id: Option<String>) -> Self
pub fn with_planning_id(self, planning_id: Option<String>) -> Self
Sets the entity’s rendered planning id (see
planning_id).
Sourcepub fn short_type_name(&self) -> &str
pub fn short_type_name(&self) -> &str
Returns the short type name (without module path).