Our great sponsors
-
inlinable-dyn-extension-traits
An exploration into the various ways optional trait methods can be implemented in Rust.
-
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.
There are some external libraries that downcasting between trait objects (e.g: intertrait), though these all use require some external runtime checking / linker shenanigans, which means they aren't amenable to the dead-code-elimination optimizations that make OPs technique work.
Funny enough, I've also been meaning to write a full blog post about it, but haven't found the time! In the meantime, I've got a rough overview of this technique as part of the gdbstub docs, and I've got a WIP repo of example code and exploratory notes that explores the technique in more detail (along with comparing it with alternative approaches)
Sure! The commit is here (I haven’t pushed the version of this commit I made on binread itself but the actual changes are identical)