[−][src]Struct mail::default_impl::HashedIdGen
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]
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_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]
fn clone(&self) -> HashedIdGen
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for HashedIdGen
[src]
impl MailIdGenComponent for HashedIdGen
[src]
fn generate_message_id(&self) -> MessageId
[src]
fn generate_content_id(&self) -> MessageId
[src]
Auto Trait Implementations
impl RefUnwindSafe for HashedIdGen
impl Send for HashedIdGen
impl Sync for HashedIdGen
impl Unpin for HashedIdGen
impl UnwindSafe for HashedIdGen
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Erased for T
impl<T> From<T> for T
[src]
impl<T> HeaderTryFrom<T> for T
[src]
fn try_from(val: T) -> Result<T, ComponentCreationError>
[src]
impl<F, T> HeaderTryInto<T> for F where
T: HeaderTryFrom<F>,
[src]
T: HeaderTryFrom<F>,
fn try_into(self) -> Result<T, ComponentCreationError>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<C> MailIdGenComponent for C where
C: Context,
[src]
C: Context,
fn generate_message_id(&self) -> MessageId
[src]
fn generate_content_id(&self) -> MessageId
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
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, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,