Rust

string

Module

String validators: substrings, globs, colors and phone numbers.

Contents

use utopia_validators::Contains;
Rust
pub struct Contains

A string containing at least one of the patterns, case-insensitively unless strict.

use utopia_validators::Globstar;
Rust
pub struct Globstar

A string matching gitignore-style glob patterns (*, **, ?, [...], \ escapes, ! exclusions).

Inclusions are OR-ed and exclusions AND-ed; a literal inclusion beats a wildcard exclusion; otherwise the last matching pattern wins. Without patterns every string is valid.

use utopia_validators::HexColor;
Rust
pub struct HexColor

A hexadecimal color code of 3 or 6 digits, without #: fff or ffffff.

use utopia_validators::Phone;
Rust
pub struct Phone

An E.164 phone number (+ and 7 to 15 digits, the first not 0), optionally repaired by Phone::normalize first.

use utopia_validators::Wildcard;
Rust
pub struct Wildcard

Accepts every value.