pub enum ProcessStep<'gc, C: CustomTypes<S>, S: System<C>> {
Idle,
Normal,
Yield,
Terminate {
result: Value<'gc, C, S>,
},
Abort {
mode: AbortMode,
},
Broadcast {
msg_type: Text,
barrier: Option<Barrier>,
targets: Option<Vec<Gc<'gc, RefLock<Entity<'gc, C, S>>>>>,
},
Watcher {
create: bool,
watcher: Watcher<'gc, C, S>,
},
Fork {
pos: usize,
locals: SymbolTable<'gc, C, S>,
entity: Gc<'gc, RefLock<Entity<'gc, C, S>>>,
},
CreatedClone {
clone: Gc<'gc, RefLock<Entity<'gc, C, S>>>,
},
DeletedClone {
clone: Gc<'gc, RefLock<Entity<'gc, C, S>>>,
},
Pause,
}
Expand description
Result of stepping through a Process
.
Variants§
Idle
The process was not running.
Normal
The process executed an instruction successfully and does not need to yield.
Yield
The process has signaled a yield point so that other code can run. Many yield results may occur back-to-back, such as while awaiting an asynchronous result.
Yielding is needed for executing an entire project’s scripts so that they can appear to run simultaneously.
If instead you are explicitly only using a single sandboxed process, this can be treated equivalently to ProcessStep::Normal
.
Terminate
The process has successfully terminated with the given return value.
Abort
Aborts zero or more running processes, possibly including this one. If this process is included in the abort set, this process is guaranteed to already be terminated. For other processes, it is up to the receiver/scheduler to respect this abort request.
Broadcast
The process has requested to broadcast a message to all entities (if target
is None
) or to a specific target
, which may trigger other code to execute.
Fields
Watcher
The process has requested to create or destroy a new watcher for a variable.
If create
is true, the process is requesting to register the given watcher.
If create
if false, the process is requesting to remove a watcher which is equivalent to the given watcher.
In either case, it is up the handler of this step mode to deduplicate watchers to the same variable, if needed.
The existence of a watcher is invisible to a process, so it is perfectly valid for implementors to simply ignore all watcher requests.
Fork
The process has requested to fork a new process that starts with the given parameters.
CreatedClone
The process has created a new clone of an existing entity. The clone has already been created, so this is just an informational flag for any logging or other initialization logic. Projects use this event to bind new scripts to the clone, which is an aspect of projects but not processes or entities.
DeletedClone
The process has requested to delete an existing clone. Projects use this event to abort all the scripts and processes associated with the deleted entity.
Pause
The process has requested to pause execution of the (entire) project. This can be useful for student debugging (similar to breakpoints), but can be ignored by the executor if desired.