Skip to main content

Readout

Trait Readout 

Source
pub trait Readout: Send + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn accepts(&self) -> &'static [SubjectKind];
    fn render(
        &self,
        ctx: &dyn ReadoutContext,
        lod: Lod,
        mode: ContentMode,
        opts: &ReadoutOptions,
        out: &mut dyn ReadoutBuf,
    ) -> usize;
}
Expand description

A named, pure rendering unit. See SRD-63 §1 for the design contract.

Implementations are stateless — every render is driven entirely by the ReadoutContext and ReadoutOptions passed in. The trait is Send + Sync so a single registry instance can be shared across the executor and the surface threads without locking.

Required Methods§

Source

fn name(&self) -> &'static str

Stable, lower-snake-case identifier. Workloads reference readouts by this name.

Source

fn accepts(&self) -> &'static [SubjectKind]

Subject kinds this readout is willing to render against. The binder validates at bake-time that every event slot’s subject kind is in this list, so a workload binding phase_outcome to on_session_end fails loudly rather than rendering silent zeros. Required: every readout declares what kinds it works against. No default — silent fallback to [Phase] would defeat the safety net the validation layer is built on.

Source

fn render( &self, ctx: &dyn ReadoutContext, lod: Lod, mode: ContentMode, opts: &ReadoutOptions, out: &mut dyn ReadoutBuf, ) -> usize

Render this readout at the given LOD and content mode, drawing data from ctx, writing into out. Returns the rendered byte width so the caller can do alignment without a second measurement pass.

Hot-path contract: must not allocate beyond what the output buffer’s growth requires.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§