Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

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 [email protected]

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.

@gregdhill gregdhill force-pushed the async branch 2 times, most recently from b20149d to 35cbdf7 Compare October 13, 2020 09:51
@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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants