Skip to content
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

Revamping the docs for 1.0 #214

Open
dherman opened this issue Sep 7, 2021 · 5 comments
Open

Revamping the docs for 1.0 #214

dherman opened this issue Sep 7, 2021 · 5 comments

Comments

@dherman
Copy link
Collaborator

dherman commented Sep 7, 2021

Here's a rough plan of attack for revamping the docs for 1.0 and beyond. I'll break it into two milestones:

1. Refresh for Node-API backend

This is more or less the minimum content needed for 1.0, refreshed to be updated for the Node-API backend.

Get Started
  • Introduction
  • Quick Start
  • Hello World!
How To
  • Primitive Types
  • Arrays
  • Objects
  • Functions
Community
  • Who's Using Neon

2. Long-term plan

This probably isn't perfect but is a draft skeleton for a more complete set of docs, to try to give a sense that the first milestone is future-compatible with a vision for a fuller set of docs.

Get Started
  • Introduction
  • Quick Start
  • Hello World!
Concepts
  • Runtime Contexts
  • Handles
  • Types and Type Inspection
  • Modules
  • Errors and Exceptions
  • The Event Loop
  • Buffers and Typed Arrays
  • Sharing Rust Data
  • Concurrency and Parallelism
How To
  • Primitive Types
  • Arrays
  • Objects
  • Functions
  • Electron Apps
  • Converting Data
Best Practices
  • Performance
  • Security
Community
  • Who's Using Neon
  • Roadmap
@kjvalencik
Copy link
Member

@dherman This looks really great! I think it might be valuable to bump a couple of concepts up into phase 1. Particularly, binary data and root/channel. I don't think we need to go into a lot of detail for Phase 1, but have enough content to ensure users know they exist.

When working with threads, it can be hard for users to know where to get started. While I don't think it's necessary to have through docs, giving a quick intro and example will let users know where to get started.

Another thought I had was on compile errors. I'm not sure if there's anything we can do to improve them since Rust doesn't have a lot of flexibility here outside of proc macros. This is the error you get when trying to move a callback to another thread without a Root:

error[E0277]: `*mut napi::bindings::types::Value__` cannot be sent between threads safely
   --> src/lib.rs:6:5
    |
6   |       std::thread::spawn(move || {
    |  _____^^^^^^^^^^^^^^^^^^_-
    | |     |
    | |     `*mut napi::bindings::types::Value__` cannot be sent between threads safely

Ideally, this would tell a user about Root.

This the error when trying to move a Context:

error[E0277]: `*mut napi::bindings::types::Env__` cannot be sent between threads safely
   --> src/lib.rs:7:5
    |
7   |       std::thread::spawn(move || {
    |  _____^^^^^^^^^^^^^^^^^^_-
    | |     |
    | |     `*mut napi::bindings::types::Env__` cannot be sent between threads safely

Ideally, this would tell a user to use Channel.

As far as I know, there's nothing in Rust to support custom errors like this. The best I can think is to try to rename the types the user sees into something helpful:

error[E0277]: `*mut napi::bindings::types::Env__` cannot be sent between threads safely
   --> src/lib.rs:7:5
    |
7   |       std::thread::spawn(move || {
    |  _____^^^^^^^^^^^^^^^^^^_-
    | |     |
    | |     `UseNeonChannelInsteadOfContext` cannot be sent between threads safely

@dherman
Copy link
Collaborator Author

dherman commented Sep 7, 2021

@kjvalencik I'm definitely open to documenting a few of the concepts for 1.0, I'll just take it one at a time.

Is your point about compiler errors that it's worth considering some documentation solutions to the problem?

@kjvalencik
Copy link
Member

@dherman Yes, these specific things are "gotchas" in Neon and without internalizing the full docs, it can be hard to know what to look for. It would be nice to document some specific errors in the docs themselves to help users.

@dherman
Copy link
Collaborator Author

dherman commented Sep 7, 2021

@kjvalencik Maybe a troubleshooting doc in the How To section?

@dherman
Copy link
Collaborator Author

dherman commented Sep 7, 2021

or "Common Pitfalls"?

dherman added a commit that referenced this issue Sep 11, 2021
Overhaul of docs:
- Top level reorganization (see #214)
- Remove out-of-date docs
- Remove the links to legacy examples (including in navbar)
- Curate the "who's using Neon" list

Co-authored-by: K.J. Valencik <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants