Skip to main content

WorkerLane

Trait WorkerLane 

Source
pub trait WorkerLane: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn render_chunk(
        &self,
        scene: &SceneState,
        range: SampleRange,
        cancel: &CancelToken,
    ) -> ChunkResult;

    // Provided method
    fn lost(&self) -> bool { ... }
}
Expand description

One backend contributing samples to an image: a joined remote worker, a TLS connection to a plain worker, or the local CPU/GPU. The crate::LanePool does not care which.

Implementations are shared across the pool’s lane threads, hence Send + Sync; one lane is only ever asked for one chunk at a time by the pool.

Required Methods§

Source

fn name(&self) -> &str

A short human-readable name for notes (“worker gpu-01”, “local CPU”).

Source

fn render_chunk( &self, scene: &SceneState, range: SampleRange, cancel: &CancelToken, ) -> ChunkResult

Traces range of scene at scene.width x scene.height and returns the summed radiance of the traced prefix.

Must return promptly (with whatever prefix is done) once cancel is raised. Must never trace or report samples outside range: a result whose done exceeds range.samples, or whose sum has the wrong length, is discarded and counted as a failed chunk.

Provided Methods§

Source

fn lost(&self) -> bool

Whether this lane’s backing resource is gone for good (a joined worker’s connection closed): the pool then removes the lane from a running epoch instead of retrying it through its backoff schedule, provided another lane remains. A lane that is the pool’s last keeps going through the ordinary failure path, so a lane that can replace its resource on its own still gets the chance. Defaults to false.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§