Coder Social home page Coder Social logo

accursed-unutterable-type-id's Introduction

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.

use accursed_unutterable_type_id::{AccursedUnutterableTypeId, AccursedUnutterablyTypeIdentified};

#[derive(AccursedUnutterablyTypeIdentified)]
struct Uwu;

let type_id = AccursedUnutterableTypeId::of::<Uwu>();
println!("{type_id:?}")

accursed-unutterable-type-id's People

Contributors

dawnofmidnight avatar nilstrieb avatar wackbyte avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

wackbyte icodein

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.