Skip to main content

SimCell

Struct SimCell 

Source
pub struct SimCell {
    pub id: String,
    pub region: Option<Region3D>,
    pub world: SimWorld,
    pub agents: Vec<AgentPolicy>,
    pub tick: Duration,
    pub next_deadline: DateTime<Utc>,
    pub co_placement: CoPlacement,
    pub priority: i32,
}
Expand description

A gang-schedulable, checkpointable simulation unit: one world shard plus its co-resident agent policy models, advancing on a fixed tick cadence.

This is the sim-native workload type. It is also called a “habitat” in product docs; SimCell is the canonical name here.

Fields§

§id: String

Stable identifier for the cell (used to build member ids and the gang id).

§region: Option<Region3D>

Optional spatial footprint for interest management.

§world: SimWorld

The authoritative simulation world shard.

§agents: Vec<AgentPolicy>

Co-resident agent policy models.

§tick: Duration

Tick cadence (wall-clock budget per simulation step).

§next_deadline: DateTime<Utc>

Absolute time the next tick is due — the EEVDF virtual deadline used by crate::scheduler::deadline.

§co_placement: CoPlacement

How members must be placed relative to one another.

§priority: i32

Base scheduling priority applied to every expanded member.

Implementations§

Source§

impl SimCell

Source

pub fn new(id: impl Into<String>, world: SimWorld, tick: Duration) -> Self

Create a new sim cell. next_deadline defaults to now + tick.

Source

pub fn with_region(self, region: Region3D) -> Self

Attach a spatial region for interest management.

Source

pub fn with_agent(self, agent: AgentPolicy) -> Self

Add an agent policy member.

Source

pub fn with_co_placement(self, policy: CoPlacement) -> Self

Set the co-placement policy.

Source

pub fn with_priority(self, priority: i32) -> Self

Set the base priority applied to every member.

Source

pub fn with_next_deadline(self, deadline: DateTime<Utc>) -> Self

Set an explicit next-tick deadline (overrides the now + tick default).

Source

pub fn member_count(&self) -> usize

Total number of members (world + agents).

Source

pub fn advance_deadline(&mut self)

Advance the deadline by one tick (used after a tick completes).

Source

pub fn expand(&self) -> Vec<SimMember>

Expand this cell into the scheduler’s SimMember list. The world is member 0; agents follow in declaration order. Each member’s workload id is deterministic (member_id) and its name embeds the cell id.

Source

pub fn members(&self) -> Vec<Workload>

Expand into bare Workloads, as required by the task signature fn members(&self) -> Vec<Workload>. Prefer SimCell::expand when you need the role/ordinal structure.

Source

pub fn gang_group(&self) -> GangGroup

Build the all-or-nothing GangGroup for this cell.

Trait Implementations§

Source§

impl Clone for SimCell

Source§

fn clone(&self) -> SimCell

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SimCell

Source§

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

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

impl<'de> Deserialize<'de> for SimCell

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for SimCell

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more