Posts with the tag rust-async:


Type-erasing trait parameters in Rust

2023-01-11 22:22:00 +00:00Freyja

Rust traits are great, but sometimes it's useful to erase compile-time trait parameters and associated types.

In this blog post, I'll show how to take a trait with type parameters, and build a container type that can contain multiple implementations with different type parameters and associated types.