Closed JosephCottam closed 2 years ago
for a short term fix, assuming all the inner members are Sync+Send you probably just need to derive Copy (and thus I think the compiler will also make you derive Clone). I'm actually half tempted to change the user facing api to split dist into its underlying bounds so that the compiler message is more explicit about what bound isn't being met.
For a long term fix, the macro should be easy to do, in fact I'm in the process of doing something similar (although a fair bit more complicated) to support operations like add, sub, mul, div, etc. I hope to push this up this week sometime.
I will try the derive-copy+clone technique. For completeness, I made a branch (issue-4-derive-dist-macro) with the example above in it.
It would be nice to make a distributed array of structs. It seems reasonable to support
#[derive(Dist)]
if a struct or enum is made entirely of things that already implementDist
. (I say 'reasonable' having never made a macro in rust, so feel free to tell me this is not a reasonable request.)Desired uses:
The use immediate use-case is to provide a mailbox-style array for doing some inter-process communication, but it would make a nice general capability.