[][src]Function mail_internals::utils::uneraser_ref

pub fn uneraser_ref<GOT: 'static, EXP: 'static>(inp: &GOT) -> Option<&EXP>

Used to undo type erasure in a generic context, roughly semantically eqivalent to creating a &Any type object from the input and then using downcast_ref::<EXP>(), except that it does not require the cration of a trait object as a step inbetween.

Note: This function can be used for some form of specialisation, (not just in a performence sense) but all "specialization path" have to be known when writing the unspeciallized version and it is easy to make functions behave in a unexpected (but safe) way so use with care.