mirror of
https://github.com/Noratrieb/accursed-unutterable-type-id.git
synced 2026-03-14 18:56:03 +01:00
readme (please)
This commit is contained in:
parent
f08e43e9e1
commit
0aca93e7af
3 changed files with 45 additions and 2 deletions
|
|
@ -6,6 +6,8 @@ name = "accursed-unutterable-type-id"
|
|||
description = "A worse version of std::any::TypeId"
|
||||
authors = ["Nilstrieb"]
|
||||
keywords = ["bad", "hack", "cursed"]
|
||||
repository = "https://github.com/Nilstrieb/accursed-unutterable-type-id"
|
||||
license = "MIT"
|
||||
version = "0.0.0-pre.cursed"
|
||||
edition = "2021"
|
||||
|
||||
|
|
|
|||
30
README.md
Normal file
30
README.md
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# accursed-unutterable-type-id
|
||||
|
||||
An accursed, unutterable type id.
|
||||
|
||||
Once upon a time, back when time may not have been a human concept but only a vague idea among the
|
||||
wise, there was [`std::any::TypeId`].
|
||||
|
||||
It was a good type, and many of these early inhabitants of planet earth were quite fond of it.
|
||||
Yet, there was a fundamental issue in it, that even the elders were not able to resolve: It
|
||||
required significant magic from the compiler. The peoples back then were no stranger to magic,
|
||||
but even just the thought of having magic in their type ids caused numerous wars among them.
|
||||
|
||||
After the last and most brutal of the so called "type-id" wars, one especially clever member of
|
||||
one of the leading clans for type id research had a breakthrough. They found a new method to
|
||||
implement type ids in user code! Even though their method had a significant disadvantage in that
|
||||
it had to be implemented using a derive macro (futuristic technology that the elderly have only
|
||||
dreamt of back then). Yet this change was accepted, and peace among the peoples ensured.
|
||||
|
||||
Using it is as simple as slapping a derive macro on your type
|
||||
and then getting the type id using [`AccursedUnutterableTypeId::of`].
|
||||
|
||||
```rust
|
||||
use accursed_unutterable_type_id::{AccursedUnutterableTypeId, AccursedUnutterablyTypeIdentified};
|
||||
|
||||
#[derive(AccursedUnutterablyTypeIdentified)]
|
||||
struct Uwu;
|
||||
|
||||
let type_id = AccursedUnutterableTypeId::of::<Uwu>();
|
||||
println!("{type_id:?}")
|
||||
```
|
||||
15
src/lib.rs
15
src/lib.rs
|
|
@ -14,7 +14,18 @@
|
|||
//! it had to be implemented using a derive macro (futuristic technology that the elderly have only
|
||||
//! dreamt of back then). Yet this change was accepted, and peace among the peoples ensured.
|
||||
//!
|
||||
//! Using it is as simple as slapping a derive macro on your type.
|
||||
//! Using it is as simple as slapping a derive macro on your type
|
||||
//! and then getting the type id using [`AccursedUnutterableTypeId::of`].
|
||||
//!
|
||||
//! ```
|
||||
//! use accursed_unutterable_type_id::{AccursedUnutterableTypeId, AccursedUnutterablyTypeIdentified};
|
||||
//!
|
||||
//! #[derive(AccursedUnutterablyTypeIdentified)]
|
||||
//! struct Uwu;
|
||||
//!
|
||||
//! let type_id = AccursedUnutterableTypeId::of::<Uwu>();
|
||||
//! println!("{type_id:?}")
|
||||
//! ```
|
||||
|
||||
use std::fmt::{Debug, Formatter};
|
||||
|
||||
|
|
@ -36,7 +47,7 @@ pub unsafe trait AccursedUnutterablyTypeIdentified: 'static {
|
|||
///
|
||||
/// It can easily be derived for your type. The derive is the only way to implement this trait.
|
||||
/// ```
|
||||
/// use accursed_unutterable_type_id::{AccursedUnutterableTypeId, AccursedUnutterablyTypeIdentified};
|
||||
/// use accursed_unutterable_type_id::AccursedUnutterablyTypeIdentified;
|
||||
///
|
||||
/// #[derive(AccursedUnutterablyTypeIdentified)]
|
||||
/// struct Uwu;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue