Skip to main content

orbital_base_components/form/
field_validation.rs

1#[derive(Debug, Clone, PartialEq)]
2pub enum FieldValidationState {
3    Error(String),
4    Success(String),
5    Warning(String),
6}
7
8impl FieldValidationState {
9    pub fn as_str(&self) -> &'static str {
10        match self {
11            Self::Error(_) => "error",
12            Self::Success(_) => "success",
13            Self::Warning(_) => "warning",
14        }
15    }
16
17    pub fn message(&self) -> &str {
18        match self {
19            Self::Error(m) | Self::Success(m) | Self::Warning(m) => m,
20        }
21    }
22}