Skip to main content

CellSource

Trait CellSource 

Source
pub trait CellSource {
    type Payload;

    // Required methods
    fn start(&mut self, cell: CellKey, now: f64) -> Result<(), LoadError>;
    fn poll(&mut self, cell: CellKey, now: f64) -> PollResult<Self::Payload>;

    // Provided method
    fn cancel(&mut self, _cell: CellKey) { ... }
}
Expand description

Die Beschaffungsseite: Datei-IO, HTTP, GPU-Upload — was auch immer eine Zell-Payload erzeugt. Reihenfolge: erst start, dann poll bis Ready/Failed; will der Streamer die Zelle nicht mehr, ruft er cancel auf.

Beide Zeit-Parameter sind die Weltzeit des Streamers — die Quelle führt keine eigene Uhr, damit ein Mock ohne Threads deterministisch bleibt und der echte IO-Pool seine Zeitgeber ebenfalls daran koppelt.

Required Associated Types§

Source

type Payload

Payload-Typ einer Zelle (z. B. Handles auf Mesh-/Batch-Bündel).

Required Methods§

Source

fn start(&mut self, cell: CellKey, now: f64) -> Result<(), LoadError>

Ladung aufnehmen. Err heißt: sofortiger Fehlschlag, kein poll.

Source

fn poll(&mut self, cell: CellKey, now: f64) -> PollResult<Self::Payload>

Fortschritt abfragen.

Provided Methods§

Source

fn cancel(&mut self, _cell: CellKey)

Der Streamer braucht die Zelle nicht mehr (nur Höflichkeit — eine bereits fertige Payload darf trotzdem geliefert werden).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§