pub trait Scorer {
type World;
type Expect;
// Required method
fn score(
&self,
expect: &Self::Expect,
artifacts: &RunArtifacts,
world: &Self::World,
) -> (String, bool);
}Expand description
Scores one expectation against the world AND artifacts a case produced. The host implements this for a
custom predicate/world; for the built-in assertions use BuiltinScorer.
score returns BOTH a human-readable label and the pass/fail in one call (the existing AetherCore
scorer kept these as a paired score()/label(); folding them avoids re-deriving the label and
guarantees the label always matches the verdict). The label is shown in the report’s per-predicate
diagnostics, so make it identify WHICH predicate it is (e.g. "SolidPlaced(>= 4)").
Required Associated Types§
Sourcetype World
type World
The world type to score against — must be the same world the paired
Harness::World produces (the runner enforces
Scorer<World = Harness::World>).
Sourcetype Expect
type Expect
The host’s predicate type — matches the element type of EvalCase::expect.
Required Methods§
Sourcefn score(
&self,
expect: &Self::Expect,
artifacts: &RunArtifacts,
world: &Self::World,
) -> (String, bool)
fn score( &self, expect: &Self::Expect, artifacts: &RunArtifacts, world: &Self::World, ) -> (String, bool)
Score one expect predicate against the post-run world and the run’s artifacts.
Returns (label, passed): a human-readable label for per-predicate diagnostics, and whether the
predicate held. Must be side-effect-free with respect to world (it takes a shared reference);
the runner may call it for several predicates over the same world. A scorer that only inspects
the world can ignore artifacts (and vice versa).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".