Trait CriterionTest
pub trait CriterionTest:
Send
+ Sync
+ 'static {
// Required method
fn test(
&self,
criterion: &dyn CriterionContext,
) -> Result<bool, CriterionTestError>;
}Expand description
A mod’s predicate for its advancement trigger, supplied as an Arc<dyn CriterionTest> to
PlayerRef::trigger_criterion.
The game calls it synchronously for each open criterion, before testing the criterion’s
player predicate. It keeps neither the test nor its context after the trigger returns.
The native and wasm interfaces are generated from this trait, not separate implementations.
Wasm predicates run synchronously through a scoped loan of the triggering import’s
store, including in an already running group. They share the outer call’s execution
budget and memory limit; the context expires when the predicate returns.
Required Methods§
fn test(
&self,
criterion: &dyn CriterionContext,
) -> Result<bool, CriterionTestError>
fn test( &self, criterion: &dyn CriterionContext, ) -> Result<bool, CriterionTestError>
Whether the mod’s part of this criterion passes. A callback that cannot run refuses with a typed error, rather than silently answering that the criterion did not match.
Trait Implementations§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".