Skip to main content

WorldCommand

Enum WorldCommand 

Source
pub enum WorldCommand {
    Spawn {
        parent: ChannelId,
        config: ChannelConfig,
        reply: Sender<Option<ChannelId>>,
    },
    SpawnWithId {
        parent: ChannelId,
        id: ChannelId,
        config: ChannelConfig,
        reply: Sender<bool>,
    },
    Kill {
        id: ChannelId,
        reason: String,
    },
    Complete {
        id: ChannelId,
        reply: Sender<bool>,
    },
    UpdateState {
        id: ChannelId,
        transition: StateTransition,
        reply: Sender<bool>,
    },
    GetState {
        id: ChannelId,
        reply: Sender<Option<ChannelState>>,
    },
    Shutdown,
}
Expand description

Commands for modifying World state.

These commands are sent to the WorldManager which applies them sequentially to maintain consistency.

Variants§

§

Spawn

Spawn a new child channel.

Creates a new channel under the specified parent with the given config. The new channel’s ID is returned via the reply channel.

Fields

§parent: ChannelId

Parent channel ID.

§config: ChannelConfig

Configuration for the new channel.

§reply: Sender<Option<ChannelId>>

Reply channel for the new channel’s ID. Returns None if parent doesn’t exist.

§

SpawnWithId

Spawn a new child channel with a pre-determined ChannelId.

Same as Spawn but the caller supplies the ID. Used by spawn_runner which needs the ID before the World is updated.

Fields

§parent: ChannelId

Parent channel ID.

§id: ChannelId

Pre-determined channel ID for the new channel.

§config: ChannelConfig

Configuration for the new channel.

§reply: Sender<bool>

Reply channel: true on success, false if parent doesn’t exist.

§

Kill

Kill a channel and all its descendants.

Removes the channel from the World entirely.

Fields

§id: ChannelId

Channel to kill.

§reason: String

Reason for killing (for logging/debugging).

§

Complete

Complete a channel successfully.

Transitions the channel to Completed state but keeps it in the World.

Fields

§id: ChannelId

Channel to complete.

§reply: Sender<bool>

Reply with success/failure.

§

UpdateState

Update a channel’s state.

Used for state transitions like Pause, Resume, AwaitApproval.

Fields

§id: ChannelId

Channel to update.

§transition: StateTransition

New state to transition to.

§reply: Sender<bool>

Reply with success/failure.

§

GetState

Query a channel’s current state (read-only).

For read operations that need consistency with pending writes.

Fields

§id: ChannelId

Channel to query.

§reply: Sender<Option<ChannelState>>

Reply with the current state, or None if not found.

§

Shutdown

Shutdown the WorldManager.

Signals the manager to stop processing commands.

Trait Implementations§

Source§

impl Debug for WorldCommand

Source§

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

Formats the value using the given formatter. 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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