InterviewBackend

Trait InterviewBackend 

Source
pub trait InterviewBackend {
    // Required method
    fn execute(&self, interview: &Interview) -> Result<Answers, BackendError>;

    // Provided method
    fn execute_with_validator(
        &self,
        interview: &Interview,
        validator: &(dyn Fn(&str, &str, &Answers) -> Result<(), String> + Send + Sync),
    ) -> Result<Answers, BackendError> { ... }
}
Expand description

Trait for interview execution backends

Required Methods§

Source

fn execute(&self, interview: &Interview) -> Result<Answers, BackendError>

Execute an interview and return the collected answers

Provided Methods§

Source

fn execute_with_validator( &self, interview: &Interview, validator: &(dyn Fn(&str, &str, &Answers) -> Result<(), String> + Send + Sync), ) -> Result<Answers, BackendError>

Execute an interview with validation support The validator function takes (field_name, value, answers) and returns validation result

Implementors§