Rust compile-time type information experiment

Related tags

Cryptography ctti
Overview

Compile-Time Type Information

This crate is an experimental standard library side implementation of potential ctti language feature.

The idea is to provide a function const fn type_info<T: ?Sized>() -> &'static Type which encodes the underlying type. Other crates can then build on top of this to provide advanced features, such as:

  1. Stable TypeId.
  2. Safe dynamic linking by comparing 2 Types across libraries.
  3. Reflection.

None of the above need to be implemented by the standard library. Everything can be built on top of compile-time type information.

Why not just this crate?

To be useful, the type information should be available to all types. Implementing it on primitives is simple, however, user types (structs, enums, unions) are impossible without either:

  1. Wrapping every type with a macro.
  2. Compiler support.

1 is the current state of many crates, such as abi_stable, safer_ffi. See impls module with example of how we do it. It works, however, it is incredibly invasive - production code requires heavy modification to the crate, and downstream crates cannot be used by them for the purposes of type layout checks.

2 becomes the only feasible solution. Depending on how advanced it is, it can also nicely handle things like self-referential structures without requiring runtime processing.

License: MIT

You might also like...
A performant, type-1 zkEVM written in Rust & SP1.
A performant, type-1 zkEVM written in Rust & SP1.

SP1 Reth SP1 Reth is a 100% open-source POC that showcases how any rollup can use SP1 to build a performant (type-1, bytecode compatible) zkEVM with l

Onlyfans-type web service based on TOR with maximum privacy features.

onionfans Onlyfans-type web service based on TOR with maximum privacy features. Features "Vanishing" single-use feed CDN links Landing page No JavaScr

A type-safe, K-sortable, globally unique identifier

type-safe-id A type-safe, K-sortable, globally unique identifier. Typed implementation of https://github.com/jetpack-io/typeid in Rust. Examples Stati

A "Type 0" zkEVM. Prove validity of Ethereum blocks using RISC Zero's zkVM

zeth NEW: Zeth now supports Optimism blocks! Just pass in --network=optimism! Zeth is an open-source ZK block prover for Ethereum built on the RISC Ze

Pure-Rust traits and utilities for constant-time cryptographic implementations.

subtle Pure-Rust traits and utilities for constant-time cryptographic implementations. It consists of a Choice type, and a collection of traits using

Rust library for practical time-lock encryption using `drand` threshold network

tlock-rs: Practical Timelock Encryption/Decryption in Rust This repo contains pure Rust implementation of drand/tlock scheme. It provides time-based e

Rust encryption library for practical time-lock encryption.

tlock_age: Hybrid Timelock Encryption/Decryption in Rust tlock_age is a library to encrypt and decrypt age filekey using tlock scheme. It provides an

a simple rust service for Scheduling commands execution on time basis, an easy alternative to cron

Tasker A Simple crate which provides a service and a configuration API for genrating commands based tasks ,on time basis. Installation build from sour

🐴 RusTOTPony — CLI manager of one-time password generators aka Google Authenticator

🐴 RusTOTPony CLI manager of time-based one-time password generators. It is a desktop alternative for Google Authenticator. Installation Arch Linux Pa

Owner
Auri
Platforms Engineer at Chorus One
Auri
This is an experiment in designing a distributed connected garden experience.

This is an experiment in designing a distributed connected garden experience. It started as an implementation of a blockchain, but has moved on to be a bit more than that. There is no proof of work like a cryptocurrency, but plays with the idea of a distributed consensus-building system.

Greg Tatum 4 Feb 28, 2022
Holochain + ZKP usage experiment in the form of battleships

Battleships Circuits Circuits nabbed from https://github.com/kunalmodi/battlesnark/tree/master. Circuits require circom to compile. cd circuits sh bui

null 4 Aug 24, 2023
Minimal compile-time Rust template engine

boilerplate boilerplate is a minimal compile-time Rust text template engine. Quick Start Add boilerplate to your project's Cargo.toml: [dependencies]

Casey Rodarmor 15 Dec 30, 2022
Rust implementation of the PTHash perfect hash function for static compile-time generated hash tables

QuickPHF QuickPHF is a Rust implementation of the PTHash minimal perfect hash function algorithm. It consists of two crates: quickphf - runtime code f

Darko Trifunovski 11 Oct 20, 2023
miners is a fast Rust library for the Maximal Information-based Nonparametric Exploration (MIC and MINE family)

miners miners is a fast Rust library for the Maximal Information-based Nonparametric Exploration (MIC and MINE family). miners using rayon and vectori

CuteSocks 7 Nov 2, 2023
Hyperswitch Card Vault is an open-source sensitive information storage system built on Rust.

Tartarus - Rust Locker Overview The Hyperswitch Card Vault (Tartarus) is a highly performant and a secure vault to save sensitive data such as payment

Juspay Technologies 9 Nov 23, 2023
Most useful information about your system in a single command.

mymy Access the most common information about your system using a single command. Mymy is a command line tool that provides the most helpful informati

Théo Crevon 5 Apr 4, 2023
A blazing fast, type-safe template engine for Rust.

markup.rs A blazing fast, type-safe template engine for Rust. markup.rs is a template engine for Rust powered by procedural macros which parses the te

Utkarsh Kukreti 209 Dec 24, 2022
A small, 8-byte, ID type for use in rust applications that need a pretty unique identifier

TinyId A small, 8-byte, ID type for use in rust applications that need a pretty unique identifier that is not required to be cryptographically secure

Tony B 1 May 4, 2022
A type-safe Rust interface to the Nix CLI

runix A typesafe interface to the nix CLI. by flox Installation Install with cargo add (Rust >= 1.64) cargo add runix Alternatively, manually add runi

flox 43 Mar 6, 2023