pub trait CuStatelessTask:
Reflect
+ Send
+ Sync {
type Input<'m>: CuMsgPack;
type Output<'m>: CuMsgPayload;
type Resources<'r>;
// Required methods
fn new(
_config: Option<&ComponentConfig>,
_resources: Self::Resources<'_>,
) -> Result<Self, CuError>
where Self: Sized;
fn process<'i, 'o>(
&self,
_ctx: &CuContext,
input: &Self::Input<'i>,
output: &mut Self::Output<'o>,
) -> Result<(), CuError>;
// Provided methods
fn register_debug_state_types(registry: &mut TypeRegistry)
where Self: Sized + GetTypeRegistration { ... }
fn debug_state_type_path() -> &'static str
where Self: Sized + TypePath { ... }
fn with_debug_state<R>(
&self,
f: impl FnOnce(&(dyn Reflect + 'static)) -> R,
) -> R
where Self: Sized { ... }
fn start(&mut self, _ctx: &CuContext) -> Result<(), CuError> { ... }
fn preprocess(&self, _ctx: &CuContext) -> Result<(), CuError> { ... }
fn postprocess(&self, _ctx: &CuContext) -> Result<(), CuError> { ... }
fn stop(&mut self, _ctx: &CuContext) -> Result<(), CuError> { ... }
}Expand description
A transform task whose per-CopperList callbacks do not mutate the task instance.
Stateless tasks have the same input/output shape as CuTask, but
preprocess, process, and postprocess receive &self. This makes the
task safe for runtimes to invoke for different CopperLists concurrently.
Construction, start, and stop remain exclusive lifecycle operations.
Stateless tasks do not require Freezable. The runtime records an empty
keyframe component for them and leaves the task instance unchanged on restore.
Implementations must be Send and Sync. Any shared state reachable
through self must preserve deterministic behavior when callbacks overlap.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn register_debug_state_types(registry: &mut TypeRegistry)where
Self: Sized + GetTypeRegistration,
fn register_debug_state_types(registry: &mut TypeRegistry)where
Self: Sized + GetTypeRegistration,
Registers the reflected type used as this task’s debug-state contract.
Sourcefn debug_state_type_path() -> &'static str
fn debug_state_type_path() -> &'static str
Returns the reflected type path used as this task’s debug-state schema.
Sourcefn with_debug_state<R>(
&self,
f: impl FnOnce(&(dyn Reflect + 'static)) -> R,
) -> Rwhere
Self: Sized,
fn with_debug_state<R>(
&self,
f: impl FnOnce(&(dyn Reflect + 'static)) -> R,
) -> Rwhere
Self: Sized,
Borrows this task’s current debug-state view.
Sourcefn start(&mut self, _ctx: &CuContext) -> Result<(), CuError>
fn start(&mut self, _ctx: &CuContext) -> Result<(), CuError>
Starts the task before its first per-CopperList callback.
Sourcefn preprocess(&self, _ctx: &CuContext) -> Result<(), CuError>
fn preprocess(&self, _ctx: &CuContext) -> Result<(), CuError>
Performs best-effort preparation for one CopperList.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".