Skip to main content

Stopper

Trait Stopper 

Source
pub trait Stopper {
    type Processor;

    // Required method
    fn should_stop(
        &self,
        processor: &Self::Processor,
        continuation_after_stop: impl FnOnce() -> Option<Continuation>,
    ) -> ControlFlow<BreakReason>;
}
Expand description

A trait for types that determine whether execution should be stopped at a given point.

Required Associated Types§

Required Methods§

Source

fn should_stop( &self, processor: &Self::Processor, continuation_after_stop: impl FnOnce() -> Option<Continuation>, ) -> ControlFlow<BreakReason>

Determines whether execution should be stopped.

The continuation_after_stop is provided in cases where simply resuming execution from the top of the continuation stack is not sufficient to continue execution correctly. For example, when stopping execution in the middle of a basic block, we need to provide a ResumeBasicBlock continuation to ensure that execution resumes at the correct operation within the basic block (i.e. the operation right after the one that was last executed before being stopped). No continuation is provided in case of error, since it is expected that execution will not be resumed.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§