Skip to main content

Entity

Struct Entity 

Source
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: String

Name of this entity.

§parent: Option<Rc<Entity>>

Optional parent entity (only the top-level should be None).

§id: Id

Unique simulation identifier used for bin/log messages.

§tracker: Tracker

Tracker used to handle trace/log events.

Implementations§

Source§

impl Entity

Source

pub fn new(parent: &Rc<Entity>, name: &str) -> Self

Create a new entity.

Source

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

Source

pub fn full_name(&self) -> String

Returns the full hierarchical name of this entity

Source

pub fn trace_enabled(&self) -> bool

Return whether trace-level events for this entity will be emitted.

Source

pub fn enabled_for(&self, level: Level) -> bool

Return whether events at the given level will be emitted for this entity.

Source

pub fn track_capacity(&self, value: usize, units: impl Into<String>)

Emit the capacity represented by this simulation entity.

Source

pub fn track_enter(&self, entered: Id)

Emit an enter event for an object.

Source

pub fn track_exit(&self, exited: Id)

Emit an exit event for an object.

Trait Implementations§

Source§

impl Debug for Entity

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Entity

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for Entity

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Entity

§

impl !Send for Entity

§

impl !Sync for Entity

§

impl !UnwindSafe for Entity

§

impl Freeze for Entity

§

impl Unpin for Entity

§

impl UnsafeUnpin for Entity

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.