Skip to content
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

Upgrade to newer Rust? #1

Open
calderonth opened this issue Jun 16, 2020 · 5 comments
Open

Upgrade to newer Rust? #1

calderonth opened this issue Jun 16, 2020 · 5 comments

Comments

@calderonth
Copy link

Hi there,

I have been trying to use this PoC code to generate some functioning code but since the blog post was written in 2017 most of the Rust ecosystem has changed and libraries it relied have evolved significantly (futures/tokio). So nothing works with an up to date Rust.

I am wondering what it would take to port some of the code to the newer APIs as I am interested in using Rust for a PoC with XDR RPC.

Thanks!

Thomas

@benbrittain
Copy link
Owner

Hey Thomas!

oof, yeah this code was very wrapped up in the futures 0.1 ecosystem which I would certainly not recommend using anymore. IIRC the serde version used here is also ancient.

It's been a while since I've thought about this code. I'll take a look at it, but I'm guessing that it's pretty non-trivial to upgrade. It'd be kinda fun though :)

@benbrittain
Copy link
Owner

it looks like this https://docs.rs/serde-xdr/0.5.1/serde_xdr/ is a replacement for half of this repo. (I can't attest to it's quality yet though)

and the other half is the codegen, which should actually be much easier than it was in 2017

@calderonth
Copy link
Author

Thanks for the reply, I'm starting with Rust but am keen to have some sort of basic plumbing working the same way you did the previous PoC.

I'm thinking of skipping the codegen part for now and get a really basic service working with the newer serde_xdr library and see how it fits in the new asyn/await paradigm. However, I'm still new to Rust and the new async/await paradigm, so might take me a while.

@benbrittain
Copy link
Owner

serde_xdr is unaware of the async/await paradigm, it'll just be (de)serialization logic. You'll want to tie it to something like smol or another async executor.

Here is a good example of using that:
https://github.com/stjepang/smol/blob/master/examples/simple-client.rs

Also, don't feel pressure to use any of the async/await stuff! Often a threadpool and traditional blocking IO is more than sufficient.

@calderonth
Copy link
Author

So serde_xdr is used by https://github.com/jvff/onc-rpc/ it doesn't really do the codegen part as it's more manual but I've managed to compile a basic version.
However, it's also relying on some of those old libraries that are now deprecated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants