-
Notifications
You must be signed in to change notification settings - Fork 96
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 about Rust support #277
Comments
Hi @Ziothh! I'm not aware of any crate to do that, no. The SWC plugin is more of a compiler extension that injects SuperJSON calls into a Next.js app during compile-time - it doesn't perform any de/serialisation in Rust. SuperJSON is built to serialize exactly the data types that exist within Javascript. Other languages have different datatypes, and any conversion between the two will always be messy. So I don't think a JS/Rust interop would be super useful. What's your usecase for this, and what other solutions have you looked at? |
Hi @Skn0tt, thanks for the quick answer. I came across this issue on BigInt can't be serialized to JSON, as you guys well know, so I was thinking about making a PR to I think it would be useful if rust servers and js clients could communicate with SuperJSON.
As a cherry on top |
That sounds interesting! There’s no such package currently. If you want to write one, i’m happy to assist. There’s two main challenges I see with it, that will probably need solving:
According to the docs, rspc already has a code-processing step. My gut feeling is that it might be easier to have RSPC generate an API client that contains all the JS <-> RS conversion needed for the specific RPC calls, as opposed to writing a SuperJSON adapter. |
I'm definitely down to write the package/crate but I'm a bit busy right now.
I'll close this for now and I'll hit you up if I need your assistance :). |
Does there exist a crate that can serialize
superjson
from and toserde-rs
structs?Correct me if I'm wrong, but the
next.js
swc
plugin just acts as a bridge between 2node
processes/modules right?The text was updated successfully, but these errors were encountered: