Zonbi
This is an experiment to make it possible to type-erase non-'static types.
How it works
With #[derive(Zonbi)], the type gets an implementation for getting a version of the type where all lifetimes are replaced with the given one.
Manual implementation is unsafe because the user must assure that the Casted type is the same as the one of the implementer.
This is used in ZonbiId, a wrapper around TypeId, which different from it's inside value, has the additional definition of behaviour for non-'static types.
ZonbiId is unique for every type, excluding its lifetimes.
Under the hood, it just uses the Zonbi trait to get the 'static version of the type and gets its TypeId.
To hold such type-erased value inside for example a box, you can use the AnyZonbi<'life> trait with the associated minimal lifetime.
Every zonbi that lives for at least 'life can be upcasted into this trait and downcasted back into it with all the lifetimes being this mininal 'life one.
Example
let mut type_map: = new;
let id = ;
type_map.insert;
let r: & = type_map..unwrap;
This is broken down example of the type_map example.
License
Dual-licensed under Apache-2.0 and MIT