pub trait WriteScoped: Sized {
type Streams: FailureStore;
// Required method
fn write_streams(&mut self) -> &mut Self::Streams;
// Provided methods
fn on_failure(&mut self, stream: StreamId, error: &ServerError) { ... }
fn capturing(&mut self, stream: StreamId) -> Option<&mut StreamCapture> { ... }
fn write_set(&mut self) -> Vec<BufferBinding> { ... }
}Expand description
A server whose device work runs inside an ExecuteScope.
A server supplies the three things a scope cannot know — where its multi-stream driver lives, what a failure means to a measurement in flight, and whether the stream is recording a graph — and gets the scope for it, which is the only way its launch and host-copy paths should touch the failure bookkeeping.
Required Associated Types§
Sourcetype Streams: FailureStore
type Streams: FailureStore
The multi-stream driver the server keeps.
Required Methods§
Sourcefn write_streams(&mut self) -> &mut Self::Streams
fn write_streams(&mut self) -> &mut Self::Streams
The driver, split-borrowed from the server so the scope can claim on
the way in and settle on the way out while body holds the rest.
Provided Methods§
Sourcefn on_failure(&mut self, stream: StreamId, error: &ServerError)
fn on_failure(&mut self, stream: StreamId, error: &ServerError)
Told about every failure a scope settles, so a measurement in flight
on stream is invalidated wherever the failure happened.
A failed candidate that benchmarked at close to zero would otherwise win a tune. The stream is named because some backends keep a measurement per stream and some keep one per device; the scope knows which stream its work was for, and the server knows which of those it is. Defaults to doing nothing, for a server that measures nothing.
Sourcefn capturing(&mut self, stream: StreamId) -> Option<&mut StreamCapture>
fn capturing(&mut self, stream: StreamId) -> Option<&mut StreamCapture>
The graph capture of the pooled stream stream folds onto, for a
server that records captures. Defaults to None, for one that does
not.
The scope is the window’s only informant. Work that fails or is skipped inside a recording window dooms it through this accessor — the recording is missing an operation and must not seal, and the replay contract has the caller write fresh inputs before each replay, clearing the very claim that would explain the hole. Work that exits clean hands the window its write set, so “recorded” and “in the graph” are the same event and cannot disagree. A server that returns its capture state gets all of that without wiring any of it.
The stream is the one the work was issued on, which the server cannot work out for itself: it runs on its own thread, so the caller’s current stream is not this one.
Sourcefn write_set(&mut self) -> Vec<BufferBinding>
fn write_set(&mut self) -> Vec<BufferBinding>
An empty write set for the caller to fill with what the work it is about to run writes.
Filled by the caller rather than inside the scope, which is what lets the body take the arguments the set was read from by value. A set left empty claims nothing, which is what a dry run wants.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".