pub trait ScanPhase: Send + Sync {
// Required methods
fn phase_number(&self) -> u8;
fn name(&self) -> &'static str;
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 ScanContext,
) -> Pin<Box<dyn Future<Output = Result<Vec<ScanFinding>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Minimal execution contract understood by the scan runner.
Implementations contain detection logic only. Scheduling, cancellation, event publication, and aggregation remain runner responsibilities.
Implementations must structurally own any child work they start. Dropping
the future returned by ScanPhase::execute must stop its child requests
and shared-state mutations; detached tasks violate this contract. The
runner structurally owns and can drop only the outer execute future. Its
panic boundary likewise covers only panics that unwind while polling that
future, not detached work or panic = "abort" builds.
§Examples
use async_trait::async_trait;
use termivar_scanner::{Result, ScanContext, ScanFinding, ScanPhase};
struct HeaderPhase;
#[async_trait]
impl ScanPhase for HeaderPhase {
fn phase_number(&self) -> u8 { 10 }
fn name(&self) -> &'static str { "header-check" }
async fn execute(&self, _ctx: &ScanContext) -> Result<Vec<ScanFinding>> {
Ok(Vec::new())
}
}Required Methods§
Sourcefn phase_number(&self) -> u8
fn phase_number(&self) -> u8
Phase number used to order the pipeline.
Sourcefn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 ScanContext,
) -> Pin<Box<dyn Future<Output = Result<Vec<ScanFinding>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 ScanContext,
) -> Pin<Box<dyn Future<Output = Result<Vec<ScanFinding>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Execute phase logic and return structured findings.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".