Skip to main content

InputProcessor

Trait InputProcessor 

Source
pub trait InputProcessor: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn process<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        input: &'life1 str,
        ctx: &'life2 PolicyContext,
    ) -> Pin<Box<dyn Future<Output = Result<InputProcessorResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;

    // Provided method
    fn priority(&self) -> u32 { ... }
}
Expand description

Input Processor trait

Processors run BEFORE execution to validate/transform user input. They MUST NOT have side effects beyond logging.

Required Methods§

Source

fn name(&self) -> &str

Processor name for logging/metrics

Source

fn process<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, input: &'life1 str, ctx: &'life2 PolicyContext, ) -> Pin<Box<dyn Future<Output = Result<InputProcessorResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Process input before execution

§Arguments
  • input - The user input to validate
  • ctx - Policy context (tenant, user, metadata)
§Returns
  • Pass - Input is safe
  • Block - Input is blocked (don’t execute)
  • Modify - Input was sanitized (use modified version)

Provided Methods§

Source

fn priority(&self) -> u32

Priority for ordering (lower = runs first)

Implementors§