GithubHelp home page GithubHelp logo

Revamping the docs for 1.0 about website HOT 5 OPEN

dherman avatar dherman commented on August 10, 2024
Revamping the docs for 1.0

from website.

Comments (5)

kjvalencik avatar kjvalencik commented on August 10, 2024 1

@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.

from website.

kjvalencik avatar kjvalencik commented on August 10, 2024

@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

from website.

dherman avatar dherman commented on August 10, 2024

@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?

from website.

dherman avatar dherman commented on August 10, 2024

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

from website.

dherman avatar dherman commented on August 10, 2024

or "Common Pitfalls"?

from website.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.