user-friendly validation for common types of input!
README.md

span_validator

Simple validation with error reporting, inspired by validator. Provide users with targeted, actionable error messages.

Why not validator?

I'd love to see this functionality become a part of validator. Until then, unless you specifically need span-based validation, just use validator. This crate only exists to provide better error messages than possible with just validator.

Example

use span_validator::email::{Error, ErrorSpan, validate_email};

// invalid"@example.com
//        ^
assert_eq!(
    validate_email(r#"invalid"@example.com"#),
    Err(ErrorSpan { error_type: Error::InvalidUserCharacter, span: 7..7 })
);