Skip to content

Commit c0c2451

Browse files
Fix formatting and optional imports
1 parent 2edf43c commit c0c2451

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/lib.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Esplora
22
//!
3-
//! This module defines a [`Builder`] struct that can create a blocking or
3+
//! This module defines a [`Builder`] struct that can create a blocking or
44
//! async Esplora client to query an Esplora backend:
55
//!
66
//! ## Examples
@@ -32,13 +32,16 @@ use bitcoin::consensus;
3232
use bitcoin::{BlockHash, Txid};
3333

3434
pub mod api;
35-
#[cfg(feature = "async")]
35+
36+
#[cfg(any(feature = "async", feature = "async-https"))]
3637
pub mod r#async;
3738
#[cfg(feature = "blocking")]
3839
pub mod blocking;
3940

4041
pub use api::*;
42+
#[cfg(feature = "blocking")]
4143
pub use blocking::BlockingClient;
44+
#[cfg(any(feature = "async", feature = "async-https"))]
4245
pub use r#async::AsyncClient;
4346

4447
pub fn convert_fee_rate(target: usize, estimates: HashMap<String, f64>) -> Result<f32, Error> {
@@ -109,13 +112,13 @@ impl Builder {
109112
#[derive(Debug)]
110113
pub enum Error {
111114
/// Error during ureq HTTP request
112-
#[cfg(feature = "ureq")]
115+
#[cfg(feature = "blocking")]
113116
Ureq(::ureq::Error),
114117
/// Transport error during the ureq HTTP call
115-
#[cfg(feature = "ureq")]
118+
#[cfg(feature = "blocking")]
116119
UreqTransport(::ureq::Transport),
117120
/// Error during reqwest HTTP request
118-
#[cfg(feature = "reqwest")]
121+
#[cfg(any(feature = "async", feature = "async-https"))]
119122
Reqwest(::reqwest::Error),
120123
/// HTTP response error
121124
HttpResponse(u16),
@@ -158,8 +161,9 @@ macro_rules! impl_error {
158161
}
159162

160163
impl std::error::Error for Error {}
161-
164+
#[cfg(feature = "blocking")]
162165
impl_error!(::ureq::Transport, UreqTransport, Error);
166+
#[cfg(any(feature = "async", feature = "async-https"))]
163167
impl_error!(::reqwest::Error, Reqwest, Error);
164168
impl_error!(io::Error, Io, Error);
165169
impl_error!(std::num::ParseIntError, Parsing, Error);
@@ -206,10 +210,7 @@ mod test {
206210
"#,
207211
)
208212
.unwrap();
209-
assert_eq!(
210-
convert_fee_rate(6, esplora_fees.clone()).unwrap(),
211-
2.236
212-
);
213+
assert_eq!(convert_fee_rate(6, esplora_fees.clone()).unwrap(), 2.236);
213214
assert_eq!(
214215
convert_fee_rate(26, esplora_fees).unwrap(),
215216
1.015,

0 commit comments

Comments
 (0)