[][src]Struct mail::default_impl::HashedIdGen

pub struct HashedIdGen { /* fields omitted */ }

a id gen implementation using hash-ing to generate part of it's left hand side

Implementations

impl HashedIdGen[src]

pub fn new(
    domain: Domain,
    part_unique_in_domain: SoftAsciiString
) -> Result<HashedIdGen, EncodingError>
[src]

create a new id gen from a Domain and a unique part.

The domain is used as the right hand side of the message id and the unique_in_domain_part is concatenated with "." and a hash from the left part. The hash is generated from and integrated and a random number generated from a internal program global counter.

The tuple (domain,part_unique_in_domain) has to be world unique. I.e. for "your" domain you have to make sure the part_unique_in_domain is unique in it's usage for message id's.

Error

If the domain is not ascii and puny code encoding it fails

Design Notes (usage of part_unique_in_domain)

While the internal global counter is enough to generate seemingly unique message id's it has two problems:

  1. the id's are only program unique but they need to be world unique, i.e. unique between restarts of the program and multiple instances running in parallel

  2. they allow guessing the underlying number exposing private information about how many mails are send

The unique part can solves one of the problems, if it is used correctly:

  1. by providing unique bytes for part_unique_in_domain so that every time a program using this library is started different bytes are passed in all any collision in message/content id's are prevented

The other problem is solved by hashing the counter with a random part.

Trait Implementations

impl Clone for HashedIdGen[src]

impl Debug for HashedIdGen[src]

impl MailIdGenComponent for HashedIdGen[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Erased for T

impl<T> From<T> for T[src]

impl<T> HeaderTryFrom<T> for T[src]

impl<F, T> HeaderTryInto<T> for F where
    T: HeaderTryFrom<F>, 
[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<C> MailIdGenComponent for C where
    C: Context
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.