neon-bindings / neon

Rust bindings for writing safe and fast native Node.js modules.
https://www.neon-bindings.com/
Apache License 2.0
8k stars 283 forks source link

Draft: stash #991

Closed kjvalencik closed 1 year ago

kjvalencik commented 1 year ago

Trying out some different ways of exporting functions.

WARNING: This is unsound. There should be a HRTB when exporting. Currently this allows exporting a function that has a Context<'static>. However, adding the HRTB causes the Function trait to hold parameters with lifetimes and the code no longer compiles. I haven't figured this out.

kjvalencik commented 1 year ago

Closing since this is very unsafe and it's not clear if it's possible to write this in a safe API that's still ergonomic.

It may be better to focus on cx helpers--that already have a clear path--and make it more ergonomic with a proc macro.