Neon: Add some examples to the documentation

Created on 15 Mar 2017  路  3Comments  路  Source: neon-bindings/neon

Hi,

first, I would like to thank dherman, jedireza and all the other contributers for buidling this awesome project! Adding Rust libraries to my Node code will be a great opportunity to speed things up and help me to learn Rust at the same time.

However, the projects documentation is somewhat lacking - especially for a rust beginner like me. It is of course complete as in it mentions all the methods, macros, etc.. but some examples of the libraries' utilities used in real code would be enormously helpful.

To give you some ideas, i struggled with

  • Returning custom JavaScript objects
  • Converting a JsArray of ints to the accordingly typed Vector
  • Exposing a constructor for my structs with the declare_type macro

Keep up the good work!

beginner friendly docs

Most helpful comment

I _wholeheartedly_ agree! I am labeling this bug help wanted because I think coming up with examples for the documentation is a fantastic way that many people could contribute. I will talk to @divmain about creating an organized list of API items so we can create a master checklist and track our progress.

All 3 comments

Can confirm, i resorted to search on github for examples, something like neon JsArray language:Rust if you're interested in JsArray. Unfortunately not all use cases i would need are covered in this way.

As an example, i still have no idea what is the purpose of a JsValue and how to convert it to something else.

I _wholeheartedly_ agree! I am labeling this bug help wanted because I think coming up with examples for the documentation is a fantastic way that many people could contribute. I will talk to @divmain about creating an organized list of API items so we can create a master checklist and track our progress.

I recently went through the documentation and I did find examples for these:

  • Converting a JsArray of ints to the accordingly typed Vector - here
  • Exposing a constructor for my structs with the declare_type macro - here

For this one I'm not sure:

  • Returning custom JavaScript objects

I did find an example that returns a JsObject here, but I suspect @reknih meant to return an instance of say an Employee class for which I couldn't find any example.

Was this page helpful?
0 / 5 - 0 ratings