Alex Balgavy

Just some stuff about me.

Here's my dotfiles repository.

Check out my blog.

My keys: PGP, SSH

My crypto wallets (BTC, XMR)


What links here:

Rust trait objects

Trait object:

You cannot use multiple non-auto traits for a trait object: you would need two pointers to two vtables. A workaround is to create a new trait with the two as bounds to combine vtables, then a blanket impl impl<T: Trait + Trait2> Trait3 for T {}, and use that in the trait object. Then you can add casting methods to get the other traits.

https://github.com/pretzelhammer/rust-blog/blob/master/posts/sizedness-in-rust.md