I've been working on my own implementation of the thin_trait_object crate, as I was unhappy with its API and wanted something 'nicer' to work with in my own projects. I also found its inner workings rather difficult to understand, and have tried to make mine a bit more readable.
Now that I feel it's in a minimum viable state, I'd love to get some feedback! Specifically, do you think I've improved on the API and what might I do to improve code readability? But most importantly, can you spot any potential unsoundness?
I didn't look at the procedural macro, but if the code in template_impl resembles accurately how macro-generated code looks, I think there's a mistake in the shim function for trait methods with &self receivers. for example:
the trait method for foo() uses a shared reference &self as the receiver:
this means there can be multple references to the object when self.foo() is called, it would be a violation of the aliasing rule to create the exclusive reference bundle: &mut Bundle<T> and &mut bundle.val: &mut T in this function:
however, this might just be an oversight in this sample "template", and the macro is correct.
other than this issue, the design looks solid to me.