feature4 implemented and working properly well

This commit is contained in:
Priec
2025-08-06 23:16:04 +02:00
parent 4c8cfd4f80
commit 34c68858a3
8 changed files with 1330 additions and 170 deletions

View File

@@ -2,6 +2,8 @@
//! Validation state management
use crate::validation::{ValidationConfig, ValidationResult};
#[cfg(feature = "validation")]
use crate::validation::{PositionMapper};
use std::collections::HashMap;
/// Validation state for all fields in a form
@@ -121,6 +123,18 @@ impl ValidationState {
pub fn get_field_result(&self, field_index: usize) -> Option<&ValidationResult> {
self.field_results.get(&field_index)
}
/// Get formatted display for a field if a custom formatter is configured.
/// Returns (formatted_text, position_mapper, optional_warning_message).
#[cfg(feature = "validation")]
pub fn formatted_for(
&self,
field_index: usize,
raw: &str,
) -> Option<(String, std::sync::Arc<dyn PositionMapper>, Option<String>)> {
let config = self.field_configs.get(&field_index)?;
config.run_custom_formatter(raw)
}
/// Check if a field has been validated
pub fn is_field_validated(&self, field_index: usize) -> bool {