-
Notifications
You must be signed in to change notification settings - Fork 282
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
Question: How to return something that borrows from the function context? #978
Comments
The issue is that The typical pattern in |
As far as I see I can't make this work with Neon, I tried looking at the |
That's what reference counting like an Arc does. It makes it cloneable (cloning increments the counter instead of copying the struct). |
I feel like I'm not clear enough on what my problem exactly is, but I have a hard time explaining it. The I have a hard time seeing what part exactly I should wrap in a Mutex, any help is much appreciated. |
After you return the value it is managed by the JS VM. The result must be You could maybe consider moving the connection with the stream using some of the crates enabling self-referential structs. |
Hi, I'm not sure how exactly to word this, so I hope the example below makes it clearer.
I'm trying to build a wrapper around a rust database client that uses postgres under the hood. But I'm having some lifetime troubles.
The specific case I'm struggling with is returning an async stream.
The problem however is that the JsFunction is a
Fn
closure, so I can't call next ondata
. And the following lifetime problem:Is what I'm trying to do even possible?
The text was updated successfully, but these errors were encountered: