danielpclark / rutie

“The Tie Between Ruby and Rust.”
MIT License
940 stars 62 forks source link

No mention to wrappable_struct! macro at README.md #122

Open abinoam opened 4 years ago

abinoam commented 4 years ago

Is it on purpose (to keep it private so you change it at the near future (or something like that))? Can I open a PR adding the examples of the documentation? (or at least citing its existence)

I've found wrappable_struct! by navigating through the documentation and it was exactly what I was needing for my lib. It was really confusing how it worked (and I'm still not so sure of everything).

It seems to me like it "attaches" an amount of allocated raw memory to the Ruby object instance. And it puts a Rust struct on it. And the rutie/rust wrapper is able to "decode/dereference" this memory. It doesn't show in any instance variable or something (from the Ruby side).

Could you give me hints for a better understanding of the macro? Can we document that on the Readme so it may be clear when to use it or not to use it?

danielpclark commented 4 years ago

I haven't used wrappable_struct! myself, the README that speaks of this is the original project ruru https://github.com/d-unseductable/ruru#wrapping-rust-data-to-ruby-objects . I'll need to refresh myself by reading the code again if I'm going to be able to add anything more helpful.

abinoam commented 4 years ago

I think I can put some basic documentation about at the README. In a way that harmonizes with the remaining docs. I'll open a PR and we can discuss further.

abinoam commented 4 years ago

@danielpclark you can look at my pet project https://github.com/abinoam/matrix_rs I think it's a really small example of how to use wrappable_struct!