-
Notifications
You must be signed in to change notification settings - Fork 227
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 hyper v0.13; use async/await #85
Conversation
I tried the obvious thing (and what I'd do in TypeScript): add
|
a590a21
to
ef96305
Compare
Well, I got it to compile locally, but the (ignored) tests don't work:
I think I need to use |
I briefly looked into Instead I got sth like this working locally: mod rpc_asyc {
use tendermint::rpc::Client;
use tokio::runtime::Builder;
use core::future::Future;
fn block_on<F: Future>(future: F) -> F::Output {
Builder::new()
.basic_scheduler()
.enable_all()
.build()
.unwrap()
.block_on(future)
}
#[test]
fn my_test() {
let cli = block_on(Client::new(&"tcp://127.0.0.1:26657".parse().unwrap())).unwrap();
let net_info = block_on(cli.net_info()).unwrap();
assert!(net_info.listening);
}
} |
FWIW I created a PR against your branch with minimal changes here: #87 (feel free to ignore/close it if you settle with another approach) |
- delete futures crate from Cargo.toml - add tokio as a dev dependency
Cool, I merged #87 into this branch. It appears to be working 🎉 I think it might be worth fixing the HTTP error handling too, which I'll take a quick stab at |
Adds a bogus error code for low-level HTTP errors, and at least captures the error message from the `http` crate or `hyper`.
Most of the integration tests pass two didn't (
|
@liamsi aah cool, well I'm guessing those weren't regressions then, so at least we're no worse off. Can you approve this PR if you think it looks good? (I may almost be ready to attempt YubiKey-backed key storage for GPG) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 👍
Yes, I think it's OK to fix those regressions in another PR. |
The crate itself builds with these changes, but the tests don't.
I'm not sure how to write tests for this (it's my first time using
async
/await
in Rust 😅)