summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFerris Tseng <ferristseng@fastmail.fm>2018-01-23 18:30:11 -0500
committerFerris Tseng <ferristseng@fastmail.fm>2018-01-23 18:30:11 -0500
commitc2f1199de55897cc98d7663f171329a04e63b230 (patch)
tree37d5fcd052f9fce50eacae78633cf09a1c8a9901
parent06a3776548b8c81226ef61715e5a2e98e29799c9 (diff)
formatting
-rw-r--r--ipfs-api/examples/add_tar.rs8
-rw-r--r--ipfs-api/examples/ping_peer.rs8
-rw-r--r--ipfs-api/examples/pubsub.rs6
-rw-r--r--ipfs-api/src/header.rs6
-rw-r--r--ipfs-api/src/read.rs17
-rw-r--r--ipfs-api/src/request/add.rs1
-rw-r--r--ipfs-api/src/request/bitswap.rs10
-rw-r--r--ipfs-api/src/request/block.rs13
-rw-r--r--ipfs-api/src/request/bootstrap.rs3
-rw-r--r--ipfs-api/src/request/cat.rs4
-rw-r--r--ipfs-api/src/request/commands.rs1
-rw-r--r--ipfs-api/src/request/config.rs3
-rw-r--r--ipfs-api/src/request/dag.rs5
-rw-r--r--ipfs-api/src/request/dht.rs27
-rw-r--r--ipfs-api/src/request/diag.rs6
-rw-r--r--ipfs-api/src/request/dns.rs4
-rw-r--r--ipfs-api/src/request/file.rs4
-rw-r--r--ipfs-api/src/request/files.rs42
-rw-r--r--ipfs-api/src/request/filestore.rs9
-rw-r--r--ipfs-api/src/request/get.rs4
-rw-r--r--ipfs-api/src/request/id.rs4
-rw-r--r--ipfs-api/src/request/log.rs11
-rw-r--r--ipfs-api/src/request/ls.rs13
-rw-r--r--ipfs-api/src/request/mod.rs4
-rw-r--r--ipfs-api/src/request/object.rs20
-rw-r--r--ipfs-api/src/request/pin.rs15
-rw-r--r--ipfs-api/src/request/ping.rs4
-rw-r--r--ipfs-api/src/request/pubsub.rs16
-rw-r--r--ipfs-api/src/request/refs.rs1
-rw-r--r--ipfs-api/src/request/stats.rs3
-rw-r--r--ipfs-api/src/request/swarm.rs2
-rw-r--r--ipfs-api/src/request/tar.rs5
-rw-r--r--ipfs-api/src/request/version.rs1
-rw-r--r--ipfs-api/src/response/bitswap.rs14
-rw-r--r--ipfs-api/src/response/block.rs3
-rw-r--r--ipfs-api/src/response/bootstrap.rs13
-rw-r--r--ipfs-api/src/response/commands.rs12
-rw-r--r--ipfs-api/src/response/config.rs2
-rw-r--r--ipfs-api/src/response/dag.rs10
-rw-r--r--ipfs-api/src/response/dht.rs19
-rw-r--r--ipfs-api/src/response/diag.rs2
-rw-r--r--ipfs-api/src/response/error.rs2
-rw-r--r--ipfs-api/src/response/file.rs9
-rw-r--r--ipfs-api/src/response/files.rs19
-rw-r--r--ipfs-api/src/response/filestore.rs6
-rw-r--r--ipfs-api/src/response/id.rs8
-rw-r--r--ipfs-api/src/response/log.rs6
-rw-r--r--ipfs-api/src/response/ls.rs13
-rw-r--r--ipfs-api/src/response/mod.rs6
-rw-r--r--ipfs-api/src/response/mount.rs7
-rw-r--r--ipfs-api/src/response/name.rs2
-rw-r--r--ipfs-api/src/response/object.rs49
-rw-r--r--ipfs-api/src/response/pin.rs18
-rw-r--r--ipfs-api/src/response/ping.rs1
-rw-r--r--ipfs-api/src/response/pubsub.rs17
-rw-r--r--ipfs-api/src/response/refs.rs4
-rw-r--r--ipfs-api/src/response/repo.rs9
-rw-r--r--ipfs-api/src/response/resolve.rs1
-rw-r--r--ipfs-api/src/response/serde.rs3
-rw-r--r--ipfs-api/src/response/stats.rs4
-rw-r--r--ipfs-api/src/response/swarm.rs30
-rw-r--r--ipfs-api/src/response/tar.rs1
-rw-r--r--ipfs-api/src/response/version.rs1
-rw-r--r--ipfs-cli/src/command/add.rs2
-rw-r--r--ipfs-cli/src/command/bitswap.rs2
-rw-r--r--ipfs-cli/src/command/block.rs9
-rw-r--r--ipfs-cli/src/command/bootstrap.rs34
-rw-r--r--ipfs-cli/src/command/cat.rs8
-rw-r--r--ipfs-cli/src/command/commands.rs3
-rw-r--r--ipfs-cli/src/command/config.rs2
-rw-r--r--ipfs-cli/src/command/dag.rs2
-rw-r--r--ipfs-cli/src/command/dht.rs10
-rw-r--r--ipfs-cli/src/command/diag.rs46
-rw-r--r--ipfs-cli/src/command/dns.rs2
-rw-r--r--ipfs-cli/src/command/file.rs2
-rw-r--r--ipfs-cli/src/command/files.rs8
-rw-r--r--ipfs-cli/src/command/filestore.rs9
-rw-r--r--ipfs-cli/src/command/mod.rs3
-rw-r--r--ipfs-cli/src/command/version.rs7
79 files changed, 190 insertions, 530 deletions
diff --git a/ipfs-api/examples/add_tar.rs b/ipfs-api/examples/add_tar.rs
index 0a1582c..401c61d 100644
--- a/ipfs-api/examples/add_tar.rs
+++ b/ipfs-api/examples/add_tar.rs
@@ -6,8 +6,8 @@
// copied, modified, or distributed except according to those terms.
//
-extern crate ipfs_api;
extern crate futures;
+extern crate ipfs_api;
extern crate tar;
extern crate tokio_core;
@@ -33,9 +33,9 @@ fn main() {
{
let mut builder = Builder::new(&mut buf);
- builder.append_path(file!()).expect(
- "failed to create tar file",
- );
+ builder
+ .append_path(file!())
+ .expect("failed to create tar file");
builder.finish().expect("failed to create tar file");
}
diff --git a/ipfs-api/examples/ping_peer.rs b/ipfs-api/examples/ping_peer.rs
index 36713ee..922aab8 100644
--- a/ipfs-api/examples/ping_peer.rs
+++ b/ipfs-api/examples/ping_peer.rs
@@ -29,9 +29,11 @@ fn main() {
let connected = client.swarm_peers();
let connected = core.run(connected).expect("expected a valid response");
- let peer = connected.peers.iter().next().expect(
- "expected at least one peer",
- );
+ let peer = connected
+ .peers
+ .iter()
+ .next()
+ .expect("expected at least one peer");
println!();
println!("discovered peer ({})", peer.peer);
diff --git a/ipfs-api/examples/pubsub.rs b/ipfs-api/examples/pubsub.rs
index 9d37c04..54a07ac 100644
--- a/ipfs-api/examples/pubsub.rs
+++ b/ipfs-api/examples/pubsub.rs
@@ -49,9 +49,9 @@ fn main() {
println!();
println!("starting task to publish messages to ({})...", TOPIC);
- event_loop.run(publish).expect(
- "expected the publish task to start",
- );
+ event_loop
+ .run(publish)
+ .expect("expected the publish task to start");
});
// This block will execute a future that suscribes to a topic,
diff --git a/ipfs-api/src/header.rs b/ipfs-api/src/header.rs
index 460af2b..aec3c0a 100644
--- a/ipfs-api/src/header.rs
+++ b/ipfs-api/src/header.rs
@@ -10,7 +10,6 @@ use hyper;
use hyper::header::{self, Header, Raw};
use std::fmt;
-
/// Header that is returned for streaming calls.
///
/// A `Trailer` header indicates that after a streaming call, there will
@@ -51,7 +50,6 @@ impl Header for Trailer {
}
}
-
/// This header is included while streaming if an error occured
/// while streaming the data.
///
@@ -69,7 +67,9 @@ impl Header for XStreamError {
if let Some(bytes) = raw.one() {
let value = String::from_utf8_lossy(bytes);
- Ok(XStreamError { error: value.into_owned() })
+ Ok(XStreamError {
+ error: value.into_owned(),
+ })
} else {
Err(hyper::Error::Header)
}
diff --git a/ipfs-api/src/read.rs b/ipfs-api/src/read.rs
index 5f60c69..5a37b08 100644
--- a/ipfs-api/src/read.rs
+++ b/ipfs-api/src/read.rs
@@ -20,7 +20,6 @@ use std::marker::PhantomData;
use tokio_io::AsyncRead;
use tokio_io::codec::Decoder;
-
/// A decoder for a response where each line is a full json object.
///
pub struct JsonLineDecoder<T> {
@@ -71,14 +70,14 @@ where
if self.parse_stream_error {
match slice.iter().position(|&x| x == b':') {
Some(colon)
- if &slice[..colon] == XStreamError::header_name().as_bytes() => {
+ if &slice[..colon] == XStreamError::header_name().as_bytes() =>
+ {
let raw = Raw::from(&slice[colon + 2..]);
match XStreamError::parse_header(&raw) {
- Ok(stream_error) => Err(
- ErrorKind::StreamError(stream_error.error)
- .into(),
- ),
+ Ok(stream_error) => {
+ Err(ErrorKind::StreamError(stream_error.error).into())
+ }
Err(_) => Err(e.into()),
}
}
@@ -95,7 +94,6 @@ where
}
}
-
/// A decoder that reads a line at a time.
///
pub struct LineDecoder;
@@ -115,8 +113,7 @@ impl Decoder for LineDecoder {
let slice = src.split_to(pos + 1);
Ok(Some(
- String::from_utf8_lossy(&slice[..slice.len() - 1])
- .into_owned(),
+ String::from_utf8_lossy(&slice[..slice.len() - 1]).into_owned(),
))
} else {
Ok(None)
@@ -124,7 +121,6 @@ impl Decoder for LineDecoder {
}
}
-
/// The state of a stream returning Chunks.
///
enum ReadState {
@@ -137,7 +133,6 @@ enum ReadState {
NotReady,
}
-
/// Reads from a stream of chunks asynchronously.
///
pub struct StreamReader<S> {
diff --git a/ipfs-api/src/request/add.rs b/ipfs-api/src/request/add.rs
index 037e57a..666041d 100644
--- a/ipfs-api/src/request/add.rs
+++ b/ipfs-api/src/request/add.rs
@@ -8,7 +8,6 @@
use request::ApiRequest;
-
pub struct Add;
impl_skip_serialize!(Add);
diff --git a/ipfs-api/src/request/bitswap.rs b/ipfs-api/src/request/bitswap.rs
index 45230cb..1f795bb 100644
--- a/ipfs-api/src/request/bitswap.rs
+++ b/ipfs-api/src/request/bitswap.rs
@@ -8,18 +8,15 @@
use request::ApiRequest;
-
#[derive(Serialize)]
pub struct BitswapLedger<'a> {
- #[serde(rename = "arg")]
- pub peer: &'a str,
+ #[serde(rename = "arg")] pub peer: &'a str,
}
impl<'a> ApiRequest for BitswapLedger<'a> {
const PATH: &'static str = "/bitswap/ledger";
}
-
pub struct BitswapStat;
impl_skip_serialize!(BitswapStat);
@@ -28,18 +25,15 @@ impl ApiRequest for BitswapStat {
const PATH: &'static str = "/bitswap/stat";
}
-
#[derive(Serialize)]
pub struct BitswapUnwant<'a> {
- #[serde(rename = "arg")]
- pub key: &'a str,
+ #[serde(rename = "arg")] pub key: &'a str,
}
impl<'a> ApiRequest for BitswapUnwant<'a> {
const PATH: &'static str = "/bitswap/stat";
}
-
#[derive(Serialize)]
pub struct BitswapWantlist<'a> {
pub peer: Option<&'a str>,
diff --git a/ipfs-api/src/request/block.rs b/ipfs-api/src/request/block.rs
index b525109..4dca973 100644
--- a/ipfs-api/src/request/block.rs
+++ b/ipfs-api/src/request/block.rs
@@ -8,18 +8,15 @@
use request::ApiRequest;
-
#[derive(Serialize)]
pub struct BlockGet<'a> {
- #[serde(rename = "arg")]
- pub hash: &'a str,
+ #[serde(rename = "arg")] pub hash: &'a str,
}
impl<'a> ApiRequest for BlockGet<'a> {
const PATH: &'static str = "/block/get";
}
-
pub struct BlockPut;
impl_skip_serialize!(BlockPut);
@@ -28,22 +25,18 @@ impl ApiRequest for BlockPut {
const PATH: &'static str = "/block/put";
}
-
#[derive(Serialize)]
pub struct BlockRm<'a> {
- #[serde(rename = "arg")]
- pub hash: &'a str,
+ #[serde(rename = "arg")] pub hash: &'a str,
}
impl<'a> ApiRequest for BlockRm<'a> {
const PATH: &'static str = "/block/rm";
}
-
#[derive(Serialize)]
pub struct BlockStat<'a> {
- #[serde(rename = "arg")]
- pub hash: &'a str,
+ #[serde(rename = "arg")] pub hash: &'a str,
}
impl<'a> ApiRequest for BlockStat<'a> {
diff --git a/ipfs-api/src/request/bootstrap.rs b/ipfs-api/src/request/bootstrap.rs
index c60072a..bc632f4 100644
--- a/ipfs-api/src/request/bootstrap.rs
+++ b/ipfs-api/src/request/bootstrap.rs
@@ -8,7 +8,6 @@
use request::ApiRequest;
-
pub struct BootstrapAddDefault;
impl_skip_serialize!(BootstrapAddDefault);
@@ -17,7 +16,6 @@ impl ApiRequest for BootstrapAddDefault {
const PATH: &'static str = "/bootstrap/add/default";
}
-
pub struct BootstrapList;
impl_skip_serialize!(BootstrapList);
@@ -26,7 +24,6 @@ impl ApiRequest for BootstrapList {
const PATH: &'static str = "/bootstrap/list";
}
-
pub struct BootstrapRmAll;
impl_skip_serialize!(BootstrapRmAll);
diff --git a/ipfs-api/src/request/cat.rs b/ipfs-api/src/request/cat.rs
index 6b958d4..f672fed 100644
--- a/ipfs-api/src/request/cat.rs
+++ b/ipfs-api/src/request/cat.rs
@@ -8,11 +8,9 @@
use request::ApiRequest;
-
#[derive(Serialize)]
pub struct Cat<'a> {
- #[serde(rename = "arg")]
- pub path: &'a str,
+ #[serde(rename = "arg")] pub path: &'a str,
}
impl<'a> ApiRequest for Cat<'a> {
diff --git a/ipfs-api/src/request/commands.rs b/ipfs-api/src/request/commands.rs
index 8dcfdee..11879f2 100644
--- a/ipfs-api/src/request/commands.rs
+++ b/ipfs-api/src/request/commands.rs
@@ -8,7 +8,6 @@
use request::ApiRequest;
-
pub struct Commands;
impl_skip_serialize!(Commands);
diff --git a/ipfs-api/src/request/config.rs b/ipfs-api/src/request/config.rs
index 13e0670..41f9ba7 100644
--- a/ipfs-api/src/request/config.rs
+++ b/ipfs-api/src/request/config.rs
@@ -8,7 +8,6 @@
use request::ApiRequest;
-
pub struct ConfigEdit;
impl_skip_serialize!(ConfigEdit);
@@ -17,7 +16,6 @@ impl ApiRequest for ConfigEdit {
const PATH: &'static str = "/config/edit";
}
-
pub struct ConfigReplace;
impl_skip_serialize!(ConfigReplace);
@@ -26,7 +24,6 @@ impl ApiRequest for ConfigReplace {
const PATH: &'static str = "/config/replace";
}
-
pub struct ConfigShow;
impl_skip_serialize!(ConfigShow);
diff --git a/ipfs-api/src/request/dag.rs b/ipfs-api/src/request/dag.rs
index cc5cf08..fc39872 100644
--- a/ipfs-api/src/request/dag.rs
+++ b/ipfs-api/src/request/dag.rs
@@ -8,18 +8,15 @@
use request::ApiRequest;
-
#[derive(Serialize)]
pub struct DagGet<'a> {
- #[serde(rename = "arg")]
- pub path: &'a str,
+ #[serde(rename = "arg")] pub path: &'a str,
}
impl<'a> ApiRequest for DagGet<'a> {
const PATH: &'static str = "/dag/get";
}
-
pub struct DagPut;
impl_skip_serialize!(DagPut);
diff --git a/ipfs-api/src/request/dht.rs b/ipfs-api/src/request/dht.rs
index dfafbc4..5d772a9 100644
--- a/ipfs-api/src/request/dht.rs
+++ b/ipfs-api/src/request/dht.rs
@@ -8,69 +8,56 @@
use request::ApiRequest;
-
#[derive(Serialize)]
pub struct DhtFindPeer<'a> {
- #[serde(rename = "arg")]
- pub peer: &'a str,
+ #[serde(rename = "arg")] pub peer: &'a str,
}
impl<'a> ApiRequest for DhtFindPeer<'a> {
const PATH: &'static str = "/dht/findpeer";
}
-
#[derive(Serialize)]
pub struct DhtFindProvs<'a> {
- #[serde(rename = "arg")]
- pub key: &'a str,
+ #[serde(rename = "arg")] pub key: &'a str,
}
impl<'a> ApiRequest for DhtFindProvs<'a> {
const PATH: &'static str = "/dht/findprovs";
}
-
#[derive(Serialize)]
pub struct DhtGet<'a> {
- #[serde(rename = "arg")]
- pub key: &'a str,
+ #[serde(rename = "arg")] pub key: &'a str,
}
impl<'a> ApiRequest for DhtGet<'a> {
const PATH: &'static str = "/dht/get";
}
-
#[derive(Serialize)]
pub struct DhtProvide<'a> {
- #[serde(rename = "arg")]
- pub key: &'a str,
+ #[serde(rename = "arg")] pub key: &'a str,
}
impl<'a> ApiRequest for DhtProvide<'a> {
const PATH: &'static str = "/dht/provide";
}
-
#[derive(Serialize)]
pub struct DhtPut<'a&g