ratatui-form 0.1.1

A Rust TUI form builder crate built on Ratatui
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Validation traits and types.

pub mod rules;

/// A validation error for a specific field.
#[derive(Debug, Clone)]
pub struct ValidationError {
    /// The ID of the field that failed validation.
    pub field_id: String,
    /// The error message.
    pub message: String,
}

/// Trait for field validators.
pub trait Validator: Send + Sync {
    /// Validates a value and returns an error message if invalid.
    fn validate(&self, value: &str) -> Result<(), String>;
}