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

conditional compilation for async roundtripper #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gregdhill
Copy link

Signed-off-by: Gregory Hill gregorydhill@outlook.com

Adds conditional compilation for optional async roundtripper. Required for rust-bitcoincore-rpc.

src/client.rs Outdated
@@ -38,11 +38,27 @@ pub trait HttpRoundTripper {
/// The type for errors generated by the roundtripper.
type Err: error::Error;

/// Make an HTTP request. In practice only POST request will be made.
/// Make a synchronous HTTP request. In practice only POST request will be made.
#[cfg(not(feature = "async"))]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just skimming, but if I understand correctly, the following would be my recommendations:

A PR like that should name async functions differently, and keep the sync versions available even when the feature is enabled. Otherwise multiple libraries might pull in jsonrpc, and then if one uses async it would break the one that doesn't.

And despite that - just because I need async in one place of the code, doesn't mean I won't need a sync version in other.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good points! I've updated the PR, although there is a bit of code duplication now.

Signed-off-by: Gregory Hill <gregorydhill@outlook.com>
@apoelstra
Copy link
Owner

apoelstra commented Nov 9, 2020

You'll probably need to mess around with Travis to avoid testing this feature on Rust 1.21. (Also, that should be 1.29 now... see #33 )

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

Successfully merging this pull request may close these issues.

None yet

3 participants