-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generalize the possibility of putting struct
or enum
in the input or output argument
#739
Comments
Let me guess what this is about: You'd like to put There is a limitation of proc-macro that we are facing here. You cannot put #[extendr]
struct Model([u8]);
#[extendr]
impl Model {
// ...
} The issue is, the macro cannot detect if you only put an At the moment, if you add If you want to send rust data to R, you can use |
Thanks for your details, I think I have mis-understand the usage of After several days of using extendr and your explanations, maybe extendr works in this way (Please correct me if I'm wrong):
The different implement details for extendr/extendr-macros/src/lib.rs Line 87 in 70720e2
It seems |
Yeah, I ended up requiring always putting
That said, for enum output, it's not a big deal to wrap an cf. https://yutannihilation.github.io/savvy/guide/enum.html#limitation |
I find requiring If you want #[extendr]
impl Model {} On the other hand, there are multiple ways one can embed As I said before, we have things in the works for this area; One particular thing I've investigated is how we return |
Thanks, this is a good way to do the same work now. #[extendr]
impl Model {} |
In current implement, we can only put
Struct
orEnum
output inimpl
but notfn
(except we also useextendr
to export theimpl
of the sameStruct
orEnum
).Hope to add something like this, in this way, we can just put
[derive(Sexp)]
followed by the creation ofStruct
orEnum
, we can then put the object in function input or output. Following code is copied directly fromextendr
, it would be better to allow users control which object (struct or enum) can be put in the input argument or output argument (Current implement only allow output or input struct or enum whoseimpl
has been exported byextendr
).The text was updated successfully, but these errors were encountered: