pub struct Entity {
pub name: String,
pub parent: Option<Rc<Entity>>,
pub id: Id,
pub tracker: Tracker,
/* private fields */
}Expand description
A simulation entity
An entity is a part of a hierarchical simulation in which it must have a
parent. The simulation top-level should be created using toplevel("name").
The entity is used when logging so that its unique ID can be emitted and it can determine which messages are emitted to both the binary and textual outputs.
Fields§
§name: StringName of this entity.
parent: Option<Rc<Entity>>Optional parent entity (only the top-level should be None).
id: IdUnique simulation identifier used for bin/log messages.
tracker: TrackerTracker used to handle trace/log events.
Implementations§
Source§impl Entity
impl Entity
Sourcepub fn new_with_renames(
parent: &Rc<Entity>,
name: &str,
aka: Option<&Aka>,
) -> Self
pub fn new_with_renames( parent: &Rc<Entity>, name: &str, aka: Option<&Aka>, ) -> Self
Create a new entity with a potential list of alternative names
Sourcepub fn trace_enabled(&self) -> bool
pub fn trace_enabled(&self) -> bool
Return whether trace-level events for this entity will be emitted.
Sourcepub fn enabled_for(&self, level: Level) -> bool
pub fn enabled_for(&self, level: Level) -> bool
Return whether events at the given level will be emitted for this entity.
Sourcepub fn track_capacity(&self, value: usize, units: impl Into<String>)
pub fn track_capacity(&self, value: usize, units: impl Into<String>)
Emit the capacity represented by this simulation entity.
Sourcepub fn track_enter(&self, entered: Id)
pub fn track_enter(&self, entered: Id)
Emit an enter event for an object.
Sourcepub fn track_exit(&self, exited: Id)
pub fn track_exit(&self, exited: Id)
Emit an exit event for an object.