I’m building up to a new idiom for dealing with generic numeric types and traits, but this is the first step. I made it more general than I probably needed for my purposes, but it seemed like a good idea to just solve the whole problem given that I was going to do much of the work anyways.
Credit to the hereditary crate for inspiration on how to do it.
I’m very new at this software publishing thing, so lemme know if I messed something up.
I wanted to mention that this reminds me of the old Delegation RFC, which some of us didn’t like, exactly because it felt like a problem for proc-macros to solve. It eventually got postponed.
But then, the delegation terminology is used in
hereditary
, so you’re probably aware of all that already ;)Anyway, other crates like
delegate
,ambassador
andportrait
are mentioned in the latest comments below that RFC. I wanted to quickly check how many dependants each one of those have, but https://crates.io can’t do that at the moment. Nice error message though!Unfortunately, I have no time to check what kind of code each one of them crates generates, so I have nothing of value to add.