pub struct ConfigBuilder(/* private fields */);Expand description
Builder for Config.
Implementations§
Source§impl ConfigBuilder
impl ConfigBuilder
Sourcepub fn strictness(self, s: Strictness) -> Self
pub fn strictness(self, s: Strictness) -> Self
Set RFC strictness level.
Sourcepub fn strip_subaddress(self) -> Self
pub fn strip_subaddress(self) -> Self
Strip subaddress from canonical form.
Sourcepub fn preserve_subaddress(self) -> Self
pub fn preserve_subaddress(self) -> Self
Keep subaddress in canonical form (default).
Sourcepub fn subaddress_separator(self, sep: char) -> Self
pub fn subaddress_separator(self, sep: char) -> Self
Set the subaddress separator character (default: +).
Sourcepub fn dots_gmail_only(self) -> Self
pub fn dots_gmail_only(self) -> Self
Strip dots only for Gmail/Googlemail.
Sourcepub fn dots_always_strip(self) -> Self
pub fn dots_always_strip(self) -> Self
Always strip dots from local part.
Sourcepub fn dots_preserve(self) -> Self
pub fn dots_preserve(self) -> Self
Preserve dots (default).
Sourcepub fn lowercase_all(self) -> Self
pub fn lowercase_all(self) -> Self
Lowercase both local part and domain.
Sourcepub fn lowercase_domain(self) -> Self
pub fn lowercase_domain(self) -> Self
Lowercase domain only (default, RFC-correct).
Sourcepub fn preserve_case(self) -> Self
pub fn preserve_case(self) -> Self
Preserve original case for local part (domain is always lowercased per RFC 5321).
Sourcepub fn domain_check_psl(self) -> Self
pub fn domain_check_psl(self) -> Self
Validate domain against Public Suffix List (requires psl feature).
Sourcepub fn domain_check_tld(self) -> Self
pub fn domain_check_tld(self) -> Self
Validate domain has a recognized TLD.
Sourcepub fn check_confusables(self) -> Self
pub fn check_confusables(self) -> Self
Enable anti-homoglyph confusable detection.
Sourcepub fn allow_domain_literal(self) -> Self
pub fn allow_domain_literal(self) -> Self
Allow domain literals like [192.168.1.1].
Sourcepub fn allow_display_name(self) -> Self
pub fn allow_display_name(self) -> Self
Allow display names like "John Doe" <john@example.com>.
Sourcepub fn allow_single_label_domain(self) -> Self
pub fn allow_single_label_domain(self) -> Self
Do not require a dot in the domain (allow single-label domains).
Sourcepub fn domain_check_syntax(self) -> Self
pub fn domain_check_syntax(self) -> Self
Syntax-only domain check (default). Resets from Psl/Tld back to syntax.
Sourcepub fn provider_aware(self) -> Self
pub fn provider_aware(self) -> Self
Enable provider-aware normalization.
When enabled, an address whose domain matches a registered
ProviderRule is normalized by that provider’s rule (dot stripping,
case folding, subaddress separator) instead of the global policies.
Addresses with no matching provider still use the global policies.
Provider lookups for is_freemail
work regardless of this setting — it only gates normalization.
Sourcepub fn add_provider(self, rule: ProviderRule) -> Self
pub fn add_provider(self, rule: ProviderRule) -> Self
Register a custom ProviderRule, extending the built-in registry.
User rules take precedence over built-ins for the same domain, so this
can also redefine a built-in provider. Affects is_freemail
always, and normalization when provider_aware is set.
Sourcepub fn providers(self, registry: ProviderRegistry) -> Self
pub fn providers(self, registry: ProviderRegistry) -> Self
Replace the entire provider registry (e.g. start from
ProviderRegistry::empty).