pub enum ParseError {
InvalidCountryCode,
NotANumber(NotANumberError),
TooShortAfterIdd,
TooShortNsn,
TooLongNsn,
}Expand description
Represents the possible errors that can occur when parsing a phone number string. This is a public-facing error enum.
Variants§
InvalidCountryCode
Invalid country code.
This error occurs if the number begins with a + but is followed by an
invalid or unrecognized country calling code.
NotANumber(NotANumberError)
The string is not a number.
The input string contains invalid characters or does not conform to a recognizable
phone number format. This variant wraps a NotANumberError for more detail.
TooShortAfterIdd
The number is too short after the International Direct Dialing (IDD) code. After stripping a valid IDD prefix, the remaining part of the number is too short to be a valid national number.
TooShortNsn
The National Significant Number (NSN) is too short. The number, after stripping the country code and any carrier codes, is shorter than any possible valid number for that region.
TooLongNsn
The National Significant Number (NSN) is too long. The number, after stripping the country code, is longer than any possible valid number for that region.