ein
U.S. Employer Identification Number (EIN) parsing and validation for Rust.
Usage
use Ein;
// Parse from string with dash
let ein: Ein = "12-3456789".parse.unwrap;
assert_eq!;
// Parse from string without dash
let ein: Ein = "123456789".parse.unwrap;
assert_eq!;
// Access components
assert_eq!;
assert_eq!;
// Create from components
let ein = new.unwrap;
Validation
Validates that the 2-digit prefix is an IRS-assigned prefix. The following prefixes are invalid (never assigned by the IRS):
00, 07, 08, 09, 17, 18, 19, 28, 29, 49, 69, 70, 78, 79, 89, 96, 97
use ;
// Invalid prefix
assert!;
// Invalid format
assert!;
Privacy
The Debug implementation masks the serial number, showing only the prefix:
let ein: Ein = "12-3456789".parse.unwrap;
assert_eq!;
License
Apache-2.0