▲ | ithkuil 2 days ago | |
I wanted this feature exactly once: I was building a memory manager for a database and I needed to know exactly how much space a deep data structure was using. The servo project has the same problem and they built a library that contained a Sized trait (don't remember the name exactly) and then inplemented that trait for a bunch of stdlib and third party types and for all their types (easy to be done via a derive macro iirc). I wanted to use that library but I also had other third party types that weren't covered by the library. The quick solution I found was to basically copy the whole library into my project so that I could add my impls in the trait definition trait. Anybody knows a better solution? |