summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFerris Tseng <ferristseng@fastmail.fm>2021-04-04 19:40:49 -0400
committerFerris Tseng <ferristseng@fastmail.fm>2021-04-04 19:40:49 -0400
commit822e0552619877634bbb6bc82ac2a398914dfc95 (patch)
tree357b1aa298a94f5e1145930a309e4f23a41f2218
parent7771a0db1374b43d2c7445f29566a5e0bd38cf22 (diff)
formatting
-rw-r--r--ipfs-api-backend-hyper/src/backend.rs22
-rw-r--r--ipfs-api/src/lib.rs6
2 files changed, 21 insertions, 7 deletions
diff --git a/ipfs-api-backend-hyper/src/backend.rs b/ipfs-api-backend-hyper/src/backend.rs
index c496de6..63359c3 100644
--- a/ipfs-api-backend-hyper/src/backend.rs
+++ b/ipfs-api-backend-hyper/src/backend.rs
@@ -17,13 +17,16 @@ use http::{
};
use hyper::{
body,
- client::{self, Builder, connect::Connect, HttpConnector},
+ client::{self, connect::Connect, Builder, HttpConnector},
};
use ipfs_api_prelude::{ApiRequest, Backend, TryFromUri};
use multipart::client::multipart;
use serde::Serialize;
-pub struct HyperBackend<C = HttpConnector> where C: Connect + Clone + Send + Sync + 'static {
+pub struct HyperBackend<C = HttpConnector>
+where
+ C: Connect + Clone + Send + Sync + 'static,
+{
base: Uri,
client: client::Client<C, hyper::Body>,
}
@@ -38,8 +41,9 @@ macro_rules! impl_default {
/// If not found, tries to connect to `localhost:5001`.
///
fn default() -> Self {
- Self::from_ipfs_config()
- .unwrap_or_else(|| Self::from_host_and_port(Scheme::HTTP, "localhost", 5001).unwrap())
+ Self::from_ipfs_config().unwrap_or_else(|| {
+ Self::from_host_and_port(Scheme::HTTP, "localhost", 5001).unwrap()
+ })
}
}
@@ -61,10 +65,16 @@ impl_default!(HttpConnector);
impl_default!(hyper_tls::HttpsConnector<HttpConnector>);
#[cfg(feature = "with-hyper-rustls")]
-impl_default!(hyper_rustls::HttpsConnector<HttpConnector>, hyper_rustls::HttpsConnector::with_native_roots());
+impl_default!(
+ hyper_rustls::HttpsConnector<HttpConnector>,
+ hyper_rustls::HttpsConnector::with_native_roots()
+);
#[async_trait(?Send)]
-impl<C> Backend for HyperBackend<C> where C: Connect + Clone + Send + Sync + 'static {
+impl<C> Backend for HyperBackend<C>
+where
+ C: Connect + Clone + Send + Sync + 'static,
+{
type HttpRequest = http::Request<hyper::Body>;
type HttpResponse = http::Response<hyper::Body>;
diff --git a/ipfs-api/src/lib.rs b/ipfs-api/src/lib.rs
index ac2932b..4007acc 100644
--- a/ipfs-api/src/lib.rs
+++ b/ipfs-api/src/lib.rs
@@ -154,7 +154,11 @@
//! ```
//!
-pub use ipfs_api_prelude::{self, IpfsApi, TryFromUri, response, request::{self, KeyType, Logger, LoggingLevel, ObjectTemplate}};
+pub use ipfs_api_prelude::{
+ self,
+ request::{self, KeyType, Logger, LoggingLevel, ObjectTemplate},
+ response, IpfsApi, TryFromUri,
+};
#[cfg(feature = "with-hyper")]
pub use ipfs_api_backend_hyper::IpfsClient;