specler/specs/
string.rs

1
2
3
4
5
6
7
8
9
10
use crate::core::validator::validator_result::ValidatorResult;

/// Validates that a string is not empty
pub fn not_empty(input: &String) -> ValidatorResult {
    if input.is_empty() {
        ValidatorResult::Invalid("String cannot be empty".to_string())
    } else {
        ValidatorResult::Valid
    }
}