Trait cargo_tarpaulin::statemachine::StateData

source ·
pub trait StateData {
    // Required methods
    fn start(&mut self) -> Result<Option<TestState>, RunError>;
    fn init(&mut self) -> Result<TestState, RunError>;
    fn wait(&mut self) -> Result<Option<TestState>, RunError>;
    fn last_wait_attempt(&mut self) -> Result<Option<TestState>, RunError>;
    fn stop(&mut self) -> Result<TestState, RunError>;
}
Expand description

Tracing a process on an OS will have platform specific code. Structs containing the platform specific datastructures should provide this trait with an implementation of the handling of the given states.

Required Methods§

source

fn start(&mut self) -> Result<Option<TestState>, RunError>

Starts the tracing. Returns None while waiting for start. Statemachine then checks timeout

source

fn init(&mut self) -> Result<TestState, RunError>

Initialises test for tracing returns next state

source

fn wait(&mut self) -> Result<Option<TestState>, RunError>

Waits for notification from test executable that there’s something to do. Selects the next appropriate state if there’s something to do otherwise None

source

fn last_wait_attempt(&mut self) -> Result<Option<TestState>, RunError>

This is here for the times when we’re about to mark the attempted coverage collection as a failure i.e. timeout, but there’s an alternative to that which can see if we’re actually in a “finished” state but are still waiting on resource cleanup so we don’t lose the results.

source

fn stop(&mut self) -> Result<TestState, RunError>

Handle a stop in the test executable. Coverage data will be collected here as well as other OS specific functions

Trait Implementations§

source§

impl<'a> StateData for Box<dyn StateData + 'a>

source§

fn start(&mut self) -> Result<Option<TestState>, RunError>

Starts the tracing. Returns None while waiting for start. Statemachine then checks timeout
source§

fn init(&mut self) -> Result<TestState, RunError>

Initialises test for tracing returns next state
source§

fn wait(&mut self) -> Result<Option<TestState>, RunError>

Waits for notification from test executable that there’s something to do. Selects the next appropriate state if there’s something to do otherwise None
source§

fn last_wait_attempt(&mut self) -> Result<Option<TestState>, RunError>

This is here for the times when we’re about to mark the attempted coverage collection as a failure i.e. timeout, but there’s an alternative to that which can see if we’re actually in a “finished” state but are still waiting on resource cleanup so we don’t lose the results.
source§

fn stop(&mut self) -> Result<TestState, RunError>

Handle a stop in the test executable. Coverage data will be collected here as well as other OS specific functions

Implementations on Foreign Types§

source§

impl StateData for ()

source§

impl<'a> StateData for Box<dyn StateData + 'a>

Implementors§