Skip to main content

prepare_text_with_context

Function prepare_text_with_context 

Source
pub fn prepare_text_with_context<F>(
    dependencies: &'static [DependencySpec],
    call: F,
) -> Arc<dyn PreparedValidator> ⓘ
where F: for<'a> Fn(&str, &BoundValidationContext<'a>) -> Result<PreparedOutcome, ExecutionError> + Send + Sync + 'static,
Expand description

Prepares a text validation closure that receives its checked dependency context.

The closure can report a valid input, one or more violation drafts, or an execution failure. BoundValidator checks declared dependencies before it invokes this adapter. When calling the returned PreparedValidator directly, the closure is responsible for reading and checking its context.

Callers must keep raw rejected input out of violation drafts and execution errors. Captured data must be owned and thread-safe.

§Type Parameters

  • F: Thread-safe operation for one text input and its dependency context.

§Parameters

  • dependencies: Static dependency slots consumed by call, in execution order.
  • call: Operation invoked with checked text and a borrowed dependency context.

§Returns

A shared prepared validator that checks the target is text before invoking call and forwards any execution errors from it unchanged. This function only constructs the adapter and does not itself return an error.