3 releases
0.1.2 | Jul 18, 2024 |
---|---|
0.1.1 | Jul 18, 2024 |
0.1.0 | Jul 18, 2024 |
#18 in #country-code
33KB
725 lines
custom-type
This crate provides utilities for parsing and validating various types of data such as emails, passwords, and phone numbers with country codes.
Features
- Parse and validate email addresses.
- Parse and validate phone numbers with country codes.
- Parse and validate passwords with different strength levels.
Usage
Add this to your Cargo.toml
:
[dependencies]
custom-type = "0.1.0"
lib.rs
:
This crate provides utilities for parsing and validating various types of data such as emails, passwords, and phone numbers with country codes.
Example
use custom_type::{Email, PhoneNumber, RawPassword, CountryCode};
let email = Email::parse("example@example.com").unwrap();
println!("{}", email);
let phone_number = PhoneNumber::parse(CountryCode::USA, "1234567890").unwrap();
println!("{}", phone_number);
let password = RawPassword::parse_strict("Valid123!").unwrap();
println!("{}", password);
Features
- Parse and validate email addresses.
- Parse and validate phone numbers with country codes.
- Parse and validate passwords with different strength levels.
Dependencies
~2.5–4MB
~76K SLoC