mirror of
https://github.com/Noratrieb/accursed-unutterable-type-id.git
synced 2026-01-15 17:05:11 +01:00
:corro:
This commit is contained in:
commit
bc58bda4a2
5 changed files with 55 additions and 0 deletions
18
src/lib.rs
Normal file
18
src/lib.rs
Normal 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()
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue