Skip to main content

PhaseHandler

Trait PhaseHandler 

Source
pub trait PhaseHandler<Input, Output, State>: Send + Sync
where Input: Send + 'static, Output: Send + 'static, State: Send + Sync + 'static,
{ // Required methods fn name(&self) -> &str; fn handle<'life0, 'life1, 'async_trait>( &'life0 self, input: Input, ctx: &'life1 mut SecretaryContext<State>, ) -> Pin<Box<dyn Future<Output = Result<PhaseResult<Output>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; // Provided method fn can_skip(&self, _input: &Input, _ctx: &SecretaryContext<State>) -> bool { ... } }
Expand description

阶段处理器Trait

用于实现工作流中的单个阶段。每个阶段接收输入,处理后产生输出。 这允许将复杂的处理逻辑拆分成多个独立的阶段。

§类型参数

  • Input: 阶段接收的输入类型
  • Output: 阶段产生的输出类型
  • State: 秘书状态类型

Required Methods§

Source

fn name(&self) -> &str

阶段名称(用于日志和调试)

Source

fn handle<'life0, 'life1, 'async_trait>( &'life0 self, input: Input, ctx: &'life1 mut SecretaryContext<State>, ) -> Pin<Box<dyn Future<Output = Result<PhaseResult<Output>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

处理输入

Provided Methods§

Source

fn can_skip(&self, _input: &Input, _ctx: &SecretaryContext<State>) -> bool

是否可以跳过此阶段

Implementors§