Trait proptest::test_runner::ResultCache[][src]

pub trait ResultCache {
    fn key(&self, key: &ResultCacheKey<'_>) -> u64;
fn put(&mut self, key: u64, result: &TestCaseResult);
fn get(&self, key: u64) -> Option<&TestCaseResult>; }

An object which can cache the outcomes of tests.

Required methods

fn key(&self, key: &ResultCacheKey<'_>) -> u64[src]

Convert the given cache key into a u64 representing that value. The u64 is used as the key below.

This is a separate step so that ownership of the key value can be handed off to user code without needing to be able to clone it.

fn put(&mut self, key: u64, result: &TestCaseResult)[src]

Save result as the outcome associated with the test input in key.

result is passed as a reference so that the decision to clone depends on whether the cache actually plans on storing it.

fn get(&self, key: u64) -> Option<&TestCaseResult>[src]

If put() has been called with a semantically equivalent key, return the saved result. Otherwise, return None.

Loading content...

Implementors

Loading content...