Our great sponsors
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
-
frunk
Funktional generic type-level programming in Rust: HList, Coproduct, Generic, LabelledGeneric, Validated, Monoid and friends.
I did a similar thing a while back but got it working on stable by hashing the string into a u128 at compile time: https://github.com/camshaft/prop-rs/blob/main/src/lib.rs.
Hey, #[derive(LabelledGeneric)] from frunk does something like this, but without const generics, so it has odd representations for things like type-level strings (it's represented as a tuple of chars so (a, b, c) is the type-level representation of the string "abc")
Related posts
- Apply generic function to every tuple element
- Self Referencing structs with different generic types
- Is there a convenient way to convert a struct<T> (where all fields are of type T) into struct<U> where U: From<T>?
- Can we make useful streaming APIs that disallow deadlocks?
- Generic associated types encode higher-order functions on types