Skip to main content

ratatui_form/validation/
mod.rs

1//! Validation traits and types.
2
3pub mod rules;
4
5/// A validation error for a specific field.
6#[derive(Debug, Clone)]
7pub struct ValidationError {
8    /// The ID of the field that failed validation.
9    pub field_id: String,
10    /// The error message.
11    pub message: String,
12}
13
14/// Trait for field validators.
15pub trait Validator: Send + Sync {
16    /// Validates a value and returns an error message if invalid.
17    fn validate(&self, value: &str) -> Result<(), String>;
18}