Skip to main content

Sudarsan's Blog

Tag: Rust

Cloning boxed traits in Rust

I enjoy coding with Rust’s composition system. It’s nice to also have generics. It makes adding and incorporating changes rather nice. I recently ran into a problem when I wanted to copy a group of boxed traits.

Lets start from the beginning. Imagine we have an http client that makes requests give a URL. Like so…