[−][src]Struct mail::default_impl::HashedIdGen
a id gen implementation using hash-ing to generate part of it's left hand side
Methods
impl HashedIdGen[src]
pub fn new(
domain: Domain,
part_unique_in_domain: SoftAsciiString
) -> Result<HashedIdGen, EncodingError>[src]
domain: Domain,
part_unique_in_domain: SoftAsciiString
) -> Result<HashedIdGen, EncodingError>
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:
-
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
-
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:
- by providing unique bytes for
part_unique_in_domainso 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 MailIdGenComponent for HashedIdGen[src]
fn generate_message_id(&self) -> MessageId[src]
fn generate_content_id(&self) -> MessageId[src]
impl Debug for HashedIdGen[src]
impl Clone for HashedIdGen[src]
fn clone(&self) -> HashedIdGen[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
Auto Trait Implementations
impl Send for HashedIdGen
impl Sync for HashedIdGen
Blanket Implementations
impl<T, U> Into for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
impl<T> From for T[src]
impl<T, U> TryFrom for T where
U: Into<T>, [src]
U: Into<T>,
type Error = !
try_from)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T> Borrow for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T, U> TryInto for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<F, T> HeaderTryInto for F where
T: HeaderTryFrom<F>, [src]
T: HeaderTryFrom<F>,
fn try_into(self) -> Result<T, ComponentCreationError>[src]
impl<T> HeaderTryFrom for T[src]
fn try_from(val: T) -> Result<T, ComponentCreationError>[src]
impl<T> Erased for T
impl<C> MailIdGenComponent for C where
C: Context, [src]
C: Context,