This commit is contained in:
nora 2022-06-17 21:06:49 +02:00
commit bc58bda4a2
5 changed files with 55 additions and 0 deletions

18
src/lib.rs Normal file
View file

@ -0,0 +1,18 @@
/// A type that can be identified by a unique `AccursedUnutterableTypeId`.
///
/// # Safety
/// This trait is only allowed to be implemented by the derive macro.
pub unsafe trait AccursedUnutterablyTypeIdentified: 'static {
fn type_id() -> AccursedUnutterableTypeId;
}
pub struct AccursedUnutterableTypeId(u64);
impl AccursedUnutterableTypeId {
pub fn of<T>() -> Self
where
T: AccursedUnutterablyTypeIdentified,
{
T::type_id()
}
}