pub trait DecoderClient: Send {
// Required methods
async fn initialize(&mut self) -> Result<(), Box<dyn Error + Send + Sync>>;
async fn decode(
&mut self,
sample: &ErrorSet,
) -> Result<Vec<Readouts>, Box<dyn Error + Send + Sync>>;
async fn reset(&mut self) -> Result<(), Box<dyn Error + Send + Sync>>;
fn simulator_name(&self) -> &'static str;
// Provided method
fn last_decode_latency_secs(&self) -> f64 { ... }
}Expand description
Trait for decoder clients that can be used with the common simulation loop.
Required Methods§
Sourceasync fn initialize(&mut self) -> Result<(), Box<dyn Error + Send + Sync>>
async fn initialize(&mut self) -> Result<(), Box<dyn Error + Send + Sync>>
Initialize the client connection and any setup required before simulation.
Sourceasync fn decode(
&mut self,
sample: &ErrorSet,
) -> Result<Vec<Readouts>, Box<dyn Error + Send + Sync>>
async fn decode( &mut self, sample: &ErrorSet, ) -> Result<Vec<Readouts>, Box<dyn Error + Send + Sync>>
Decode a sample and return each gadget’s readouts and statistics in program order.
Sourceasync fn reset(&mut self) -> Result<(), Box<dyn Error + Send + Sync>>
async fn reset(&mut self) -> Result<(), Box<dyn Error + Send + Sync>>
Reset the decoder state for the next shot.
Sourcefn simulator_name(&self) -> &'static str
fn simulator_name(&self) -> &'static str
Get the name of the simulator for logging purposes.
Provided Methods§
Sourcefn last_decode_latency_secs(&self) -> f64
fn last_decode_latency_secs(&self) -> f64
Return the latency of the last decode batch (time from sending the final measurement batch to receiving readouts). For batch mode this equals the total decode time; for streaming mode it measures only the final blocking call. Returns 0.0 if not applicable.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".