Struct subplotlib::prelude::ScenarioStep
source · [−]pub struct ScenarioStep { /* private fields */ }
Expand description
A ScenarioStep is one step in a scenario.
In essence, a scenario step is a named closure. Its name can be used when reporting an error encountered in running a scenario.
Scenario steps are typically constructed from step builders, rather than directly. This permits the step builder to correctly register context types etc.
let step = ScenarioStep::new(
"when everything works".to_string(), |ctx, ok| Ok(()), |scen| ()
);
Implementations
sourceimpl ScenarioStep
impl ScenarioStep
sourcepub fn new<F, R>(step_text: String, func: F, reg: R) -> Self where
F: Fn(&ScenarioContext, bool) -> StepResult + 'static,
R: Fn(&Scenario) + 'static,
pub fn new<F, R>(step_text: String, func: F, reg: R) -> Self where
F: Fn(&ScenarioContext, bool) -> StepResult + 'static,
R: Fn(&Scenario) + 'static,
Create a new scenario step taking the scenario context
This is used to construct a scenario step from a function which takes the scenario context container. This will generally be called from the generated build method for the step.
sourcepub fn call(&self, context: &ScenarioContext, defuse_poison: bool) -> StepResult
pub fn call(&self, context: &ScenarioContext, defuse_poison: bool) -> StepResult
Call the step function
This simply calls the encased step function
Auto Trait Implementations
impl !RefUnwindSafe for ScenarioStep
impl !Send for ScenarioStep
impl !Sync for ScenarioStep
impl Unpin for ScenarioStep
impl !UnwindSafe for ScenarioStep
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more