diff options
author | Ferris Tseng <ferristseng@fastmail.fm> | 2018-08-04 12:19:25 -0400 |
---|---|---|
committer | Ferris Tseng <ferristseng@fastmail.fm> | 2018-08-04 12:19:25 -0400 |
commit | 3a2b3a8cb9ec71e07faaae59fb144151eb997fdc (patch) | |
tree | 0a224f487848e1c65868140f251f926257384815 /ipfs-api/examples | |
parent | c37a49f137637c1041186143788460e5ddf28822 (diff) |
formatting
Diffstat (limited to 'ipfs-api/examples')
-rw-r--r-- | ipfs-api/examples/add_file.rs | 2 | ||||
-rw-r--r-- | ipfs-api/examples/add_tar.rs | 6 | ||||
-rw-r--r-- | ipfs-api/examples/bootstrap_default.rs | 8 | ||||
-rw-r--r-- | ipfs-api/examples/dns.rs | 6 | ||||
-rw-r--r-- | ipfs-api/examples/mfs.rs | 12 | ||||
-rw-r--r-- | ipfs-api/examples/ping_peer.rs | 8 | ||||
-rw-r--r-- | ipfs-api/examples/pubsub.rs | 8 |
7 files changed, 20 insertions, 30 deletions
diff --git a/ipfs-api/examples/add_file.rs b/ipfs-api/examples/add_file.rs index 7784c89..d771966 100644 --- a/ipfs-api/examples/add_file.rs +++ b/ipfs-api/examples/add_file.rs @@ -10,8 +10,8 @@ extern crate futures; extern crate hyper; extern crate ipfs_api; -use ipfs_api::IpfsClient; use futures::Future; +use ipfs_api::IpfsClient; use std::fs::File; // Creates an Ipfs client, and adds this source file to Ipfs. diff --git a/ipfs-api/examples/add_tar.rs b/ipfs-api/examples/add_tar.rs index 1880712..1dc3b61 100644 --- a/ipfs-api/examples/add_tar.rs +++ b/ipfs-api/examples/add_tar.rs @@ -45,12 +45,10 @@ fn main() { println!(); client.tar_cat(&add.hash[..]).concat2() - }) - .map(|cat| { + }).map(|cat| { println!("{}", String::from_utf8_lossy(&cat[..])); println!(); - }) - .map_err(|e| eprintln!("{}", e)); + }).map_err(|e| eprintln!("{}", e)); hyper::rt::run(req) } diff --git a/ipfs-api/examples/bootstrap_default.rs b/ipfs-api/examples/bootstrap_default.rs index 79c66ab..1d6d75c 100644 --- a/ipfs-api/examples/bootstrap_default.rs +++ b/ipfs-api/examples/bootstrap_default.rs @@ -10,8 +10,8 @@ extern crate futures; extern crate hyper; extern crate ipfs_api; -use ipfs_api::IpfsClient; use futures::Future; +use ipfs_api::IpfsClient; // Lists clients in bootstrap list, then adds the default list, then removes // them, and readds them. @@ -49,13 +49,11 @@ fn main() { println!("dropping all bootstrap peers..."); drop - }) - .and_then(|_| { + }).and_then(|_| { println!(); println!("adding default peers..."); add - }) - .map_err(|e| eprintln!("{}", e)), + }).map_err(|e| eprintln!("{}", e)), ); } diff --git a/ipfs-api/examples/dns.rs b/ipfs-api/examples/dns.rs index 78b4086..2bbb92a 100644 --- a/ipfs-api/examples/dns.rs +++ b/ipfs-api/examples/dns.rs @@ -27,16 +27,14 @@ fn main() { println!(); client.file_ls(&dns.path[..]) - }) - .map(|contents| { + }).map(|contents| { println!("found contents:"); for directory in contents.objects.values() { for file in directory.links.iter() { println!("[{}] ({} bytes)", file.name, file.size); } } - }) - .map_err(|e| eprintln!("{}", e)); + }).map_err(|e| eprintln!("{}", e)); hyper::rt::run(req); } diff --git a/ipfs-api/examples/mfs.rs b/ipfs-api/examples/mfs.rs index 8bea192..2a99bea 100644 --- a/ipfs-api/examples/mfs.rs +++ b/ipfs-api/examples/mfs.rs @@ -53,22 +53,19 @@ fn main() { println!(); mkdir_recursive - }) - .and_then(|_| { + }).and_then(|_| { println!("getting status of /test/does..."); println!(); file_stat - }) - .and_then(|stat| { + }).and_then(|stat| { print_stat(stat); println!("writing source file to /test/mfs.rs"); println!(); file_write - }) - .and_then(|_| file_write_stat) + }).and_then(|_| file_write_stat) .and_then(|stat| { print_stat(stat); @@ -76,8 +73,7 @@ fn main() { println!(); file_rm - }) - .map(|_| println!("done!")) + }).map(|_| println!("done!")) .map_err(|e| eprintln!("{}", e)), ) } diff --git a/ipfs-api/examples/ping_peer.rs b/ipfs-api/examples/ping_peer.rs index be55dd5..9cd7835 100644 --- a/ipfs-api/examples/ping_peer.rs +++ b/ipfs-api/examples/ping_peer.rs @@ -11,7 +11,7 @@ extern crate hyper; extern crate ipfs_api; use futures::{Future, Stream}; -use ipfs_api::{IpfsClient, response::PingResponse}; +use ipfs_api::{response::PingResponse, IpfsClient}; // Creates an Ipfs client, discovers a connected peer, and pings it using the // streaming Api, and by collecting it into a collection. @@ -51,13 +51,11 @@ fn main() { ping_gather }) - }) - .map(|pings: Vec<PingResponse>| { + }).map(|pings: Vec<PingResponse>| { for ping in pings.iter() { println!("got response ({:?}) at ({})...", ping.text, ping.time); } - }) - .map_err(|e| eprintln!("{}", e)); + }).map_err(|e| eprintln!("{}", e)); hyper::rt::run(req); } diff --git a/ipfs-api/examples/pubsub.rs b/ipfs-api/examples/pubsub.rs index 876ec04..f773841 100644 --- a/ipfs-api/examples/pubsub.rs +++ b/ipfs-api/examples/pubsub.rs @@ -13,7 +13,10 @@ extern crate tokio_timer; use futures::{Future, Stream}; use ipfs_api::IpfsClient; -use std::{thread, time::{Duration, Instant}}; +use std::{ + thread, + time::{Duration, Instant}, +}; use tokio_timer::Interval; static TOPIC: &'static str = "test"; @@ -65,8 +68,7 @@ fn main() { println!("received ({:?})", msg); Ok(()) - }) - .map_err(|e| eprintln!("{}", e)), + }).map_err(|e| eprintln!("{}", e)), ) } } |