Skip to main content

ConfigBuilder

Struct ConfigBuilder 

Source
pub struct ConfigBuilder(/* private fields */);
Expand description

Builder for Config.

Implementations§

Source§

impl ConfigBuilder

Source

pub fn strictness(self, s: Strictness) -> Self

Set RFC strictness level.

Source

pub fn strip_subaddress(self) -> Self

Strip subaddress from canonical form.

Source

pub fn preserve_subaddress(self) -> Self

Keep subaddress in canonical form (default).

Source

pub fn subaddress_separator(self, sep: char) -> Self

Set the subaddress separator character (default: +).

Source

pub fn dots_gmail_only(self) -> Self

Strip dots only for Gmail/Googlemail.

Source

pub fn dots_always_strip(self) -> Self

Always strip dots from local part.

Source

pub fn dots_preserve(self) -> Self

Preserve dots (default).

Source

pub fn lowercase_all(self) -> Self

Lowercase both local part and domain.

Source

pub fn lowercase_domain(self) -> Self

Lowercase domain only (default, RFC-correct).

Source

pub fn preserve_case(self) -> Self

Preserve original case for local part (domain is always lowercased per RFC 5321).

Source

pub fn domain_check_psl(self) -> Self

Validate domain against Public Suffix List (requires psl feature).

Source

pub fn domain_check_tld(self) -> Self

Validate domain has a recognized TLD.

Source

pub fn check_confusables(self) -> Self

Enable anti-homoglyph confusable detection.

Source

pub fn allow_domain_literal(self) -> Self

Allow domain literals like [192.168.1.1].

Source

pub fn allow_display_name(self) -> Self

Allow display names like "John Doe" <john@example.com>.

Source

pub fn allow_single_label_domain(self) -> Self

Do not require a dot in the domain (allow single-label domains).

Source

pub fn domain_check_syntax(self) -> Self

Syntax-only domain check (default). Resets from Psl/Tld back to syntax.

Source

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.

Source

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.

Source

pub fn providers(self, registry: ProviderRegistry) -> Self

Replace the entire provider registry (e.g. start from ProviderRegistry::empty).

Source

pub fn build(self) -> Config

Build the config.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.