Trait SimObject

Source
pub trait SimObject:
    Clone
    + Debug
    + Display
    + Unique
    + TotalBytes
    + 'static { }
Expand description

A super-trait that objects that are passed around the simulation have to implement

  • Clone: It would be nice to use Copy instead, but given that things like Vec are not Copy we have to use Clone instead to allow the application to keep copies of objects sent around.
  • Debug: In order to print “{:?}” objects have to at least implement Debug. We could require Display, but that requires explicit implementation.
  • Routable: Allows routing.
  • TotalBytes: Allows rate limiting.
  • Unique: Allows for unique identification of Entities.
  • ’static: Due to the way that futures are implemented, the lifetimes need to be static. This means that objects may have to be placed in Box` to make the static.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl SimObject for i32

Source§

impl SimObject for usize

Implementors§