Skip to main content

validate_postal_code

Function validate_postal_code 

Source
pub fn validate_postal_code(postal_code: &str) -> Result<(), ProxyError>
Expand description

Returns Ok(()) when postal_code is a valid operator-supplied postal / ZIP code, otherwise an crate::error::ProxyError::InvalidGeoMetadata.

postal_code must be 1-16 characters. The format is per-country (e.g. "94110" for US ZIP, "SW1A 1AA" for UK, "100-0001" for Japan); the validator only enforces a length ceiling and rejects empty strings.