// For custom validation, implement the Validator trait
implValidatorforCustomValidator{
fnvalidate(&self,line: &str)-> ValidationResult{
ifline=="complete"{
ValidationResult::Complete
}else{
ValidationResult::Incomplete
}
}
}
fnmain()-> io::Result<()>{
println!("Input \"complete\" followed by [Enter], will accept the input line (Signal::Succeed will be called)\nPressing [Enter] will in other cases give you a multi-line prompt.\nAbort with Ctrl-C or Ctrl-D");