Comments (5)
@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.
@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.
@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.
@kjvalencik Maybe a troubleshooting doc in the How To section?
from website.
or "Common Pitfalls"?
from website.
Related Issues (20)
- remove type inference from primitives section
- Note that buffer type is deprecated
- Change FunctionContext to Context in Objects section
- Grammar fixes
- Rename "Calling Functions by Indexes" title to "Extracting Arguments by Index"
- Downcasting example doesn't compile
- Provide examples of functions that could be memory leaks in Neon
- Write doc: the `Handling Errors` HOT 1
- Fix the broken link or set a URL redirection to the rustdoc: `API docs` in the blog page
- Fix the broken link: `full demo` in the `Electron Apps` page
- Fix/Remove the broken links in the old blog
- simplify styling
- migrate to github actions
- navbar links hard to see HOT 1
- `cx.check_argument` doesn't exist
- Update promise docs to reflect a more realistic use case
- Some questions about translation HOT 3
- Have this example problem ?
- Remove node-fuzzy-phrase from https://neon-bindings.com/docs/example-projects
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from website.