website icon indicating copy to clipboard operation
website copied to clipboard

Feedback for “Class”

Open michaeljones opened this issue 3 years ago • 0 comments

I'm trying to use napi-rs at the moment for a project and I'm generally very impressed and grateful for what you have created.

Yesterday I had the experience of getting quite confused about an error which said

the trait NapiValue is not implemented for MyValue

And I couldn't see anything about MyValue that would be causing the problem given how I was setting it up. It turned out that I had another struct with #[napi] which had a pub value: MyValue field and it was the pub that was triggering the error. It never should have been pub but I guess I typed it accidentally at some point. I realise it is hard to control the kind of errors that the compiler produces in this situation but I'm wondering if the docs could be extended to include a section about pub fields and their implications and the kind of error that I ran into.

I would be happy to try to provide some text or a PR if that would be useful.

michaeljones avatar May 10 '23 11:05 michaeljones