summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFerris Tseng <ferris@navapbc.com>2019-12-24 12:59:51 -0500
committerFerris Tseng <ferris@navapbc.com>2019-12-24 12:59:51 -0500
commitcef3df9cd1958315dcc5cc4264a82e2574310330 (patch)
treed395217f2c0bb39a9e8dedc3a866dc105a436484
parent99f77b44c9641412b4dea7975de6eaf3cfa043f0 (diff)
cleaning up doc tests
-rw-r--r--Cargo.lock71
-rw-r--r--ipfs-api/src/client.rs553
-rw-r--r--ipfs-api/src/lib.rs137
3 files changed, 183 insertions, 578 deletions
diff --git a/Cargo.lock b/Cargo.lock
index c98dc49..0681c16 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -267,14 +267,6 @@ dependencies = [
]
[[package]]
-name = "ansi_term"
-version = "0.11.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
name = "arc-swap"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -300,15 +292,6 @@ dependencies = [
]
[[package]]
-name = "atty"
-version = "0.2.13"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
- "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
name = "autocfg"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -477,20 +460,6 @@ dependencies = [
]
[[package]]
-name = "clap"
-version = "2.33.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
- "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
- "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
name = "cloudabi"
version = "0.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -998,16 +967,6 @@ dependencies = [
]
[[package]]
-name = "ipfs-cli"
-version = "0.4.1"
-dependencies = [
- "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "hyper 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "ipfs-api 0.5.2",
-]
-
-[[package]]
name = "itoa"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1623,11 +1582,6 @@ dependencies = [
]
[[package]]
-name = "strsim"
-version = "0.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
name = "syn"
version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1673,14 +1627,6 @@ dependencies = [
]
[[package]]
-name = "textwrap"
-version = "0.11.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
name = "thread_local"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1841,11 +1787,6 @@ version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
-name = "unicode-width"
-version = "0.1.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
name = "unicode-xid"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1866,11 +1807,6 @@ version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
-name = "vec_map"
-version = "0.8.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
name = "walkdir"
version = "2.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1987,12 +1923,10 @@ dependencies = [
"checksum actix-web-codegen 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de0878b30e62623770a4713a6338329fd0119703bafc211d3e4144f4d4a7bdd5"
"checksum adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5d2e7343e7fc9de883d1b0341e0b13970f764c14101234857d2ddafa1cb1cac2"
"checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d"
-"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
"checksum arc-swap 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d7b8a9123b8027467bce0099fe556c628a53c8d83df0507084c31e9ba2e39aff"
"checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee"
"checksum arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8"
"checksum async-trait 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)" = "8b6dd385bb33043b833ba049048d57bdbb4d654a121ed68c71871ca51ff67070"
-"checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90"
"checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2"
"checksum awc 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d7601d4d1d7ef2335d6597a41b5fe069f6ab799b85f53565ab390e7b7065aac5"
"checksum backtrace 0.3.40 (registry+https://github.com/rust-lang/crates.io-index)" = "924c76597f0d9ca25d762c25a4d369d51267536465dc5064bdf0eb073ed477ea"
@@ -2014,7 +1948,6 @@ dependencies = [
"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
"checksum chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "31850b4a4d6bae316f7a09e691c944c28299298837edc0a03f755618c23cbc01"
"checksum cid 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6908948032561f2550467a477f659cdc358320a805237b9b5035c0350c441def"
-"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9"
"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
"checksum common-multipart-rfc7578 0.2.0-rc (registry+https://github.com/rust-lang/crates.io-index)" = "7471b7b1588b2cda44e0cdf3fd3da5706c1b46224dbf486c3daceb6655ec191c"
"checksum constant_time_eq 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "995a44c877f9212528ccc74b21a232f66ad69001e40ede5bcee2ac9ef2657120"
@@ -2145,12 +2078,10 @@ dependencies = [
"checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
"checksum smallvec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44e59e0c9fa00817912ae6e4e6e3c4fe04455e75699d06eedc7d85917ed8e8f4"
"checksum socket2 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "e8b74de517221a2cb01a53349cf54182acdc31a074727d3079068448c0676d85"
-"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
"checksum syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "dff0acdb207ae2fe6d5976617f887eb1e35a2ba52c13c7234c790960cdad9238"
"checksum synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545"
"checksum tar 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)" = "b3196bfbffbba3e57481b6ea32249fbaf590396a52505a2615adbb79d9d826d3"
"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9"
-"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
"checksum threadpool 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e2f0c90a5f3459330ac8bc0d2f879c693bb7a2f59689c1083fc4ef83834da865"
"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f"
@@ -2167,11 +2098,9 @@ dependencies = [
"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5"
"checksum unicode-normalization 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b561e267b2326bb4cebfc0ef9e68355c7abe6c6f522aeac2f5bf95d56c59bdcf"
"checksum unicode-segmentation 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0"
-"checksum unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479"
"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
"checksum url 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "75b414f6c464c879d7f9babf951f23bc3743fb7313c081b2e6ca719067ea9d61"
"checksum vcpkg 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3fc439f2794e98976c88a2a2dafce96b930fe8010b0a256b3c2199a773933168"
-"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"
"checksum walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9658c94fa8b940eab2250bd5a457f9c48b748420d71293b165c8cdbe2f55f71e"
"checksum want 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0"
"checksum wasi 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b89c3ce4ce14bdc6fb6beaf9ec7928ca331de5df7e5ea278375642a2f478570d"
diff --git a/ipfs-api/src/client.rs b/ipfs-api/src/client.rs
index 8465e07..880af32 100644
--- a/ipfs-api/src/client.rs
+++ b/ipfs-api/src/client.rs
@@ -472,16 +472,12 @@ impl IpfsClient {
/// # Examples
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
/// use std::io::Cursor;
///
- /// # fn main() {
/// let client = IpfsClient::default();
/// let data = Cursor::new("Hello World!");
- /// let req = client.add(data);
- /// # }
+ /// let res = client.add(data);
/// ```
///
#[inline]
@@ -504,15 +500,11 @@ impl IpfsClient {
/// # Examples
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
/// let path = "./src";
- /// let req = client.add_path(path);
- /// # }
+ /// let res = client.add_path(path);
/// ```
///
#[inline]
@@ -582,14 +574,10 @@ impl IpfsClient {
/// # Examples
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.bitswap_ledger("QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ");
- /// # }
+ /// let res = client.bitswap_ledger("QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ");
/// ```
///
#[inline]
@@ -605,14 +593,10 @@ impl IpfsClient {
/// # Examples
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.bitswap_reprovide();
- /// # }
+ /// let res = client.bitswap_reprovide();
/// ```
///
#[inline]
@@ -625,14 +609,10 @@ impl IpfsClient {
/// # Examples
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.bitswap_stat();
- /// # }
+ /// let res = client.bitswap_stat();
/// ```
///
#[inline]
@@ -645,14 +625,10 @@ impl IpfsClient {
/// # Examples
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.bitswap_unwant("QmXdNSQx7nbdRvkjGCEQgVjVtVwsHvV8NmV2a8xzQVwuFA");
- /// # }
+ /// let res = client.bitswap_unwant("QmXdNSQx7nbdRvkjGCEQgVjVtVwsHvV8NmV2a8xzQVwuFA");
/// ```
///
#[inline]
@@ -669,14 +645,12 @@ impl IpfsClient {
/// # Examples
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.bitswap_wantlist(Some("QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ"));
- /// # }
+ /// let res = client.bitswap_wantlist(
+ /// Some("QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ")
+ /// );
/// ```
///
#[inline]
@@ -692,17 +666,15 @@ impl IpfsClient {
/// # Examples
///
/// ```no_run
- /// # extern crate futures;
- /// # extern crate ipfs_api;
- /// #
- /// use futures::Stream;
+ /// use futures::TryStreamExt;
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
/// let hash = "QmXdNSQx7nbdRvkjGCEQgVjVtVwsHvV8NmV2a8xzQVwuFA";
- /// let req = client.block_get(hash).concat2();
- /// # }
+ /// let res = client
+ /// .block_get(hash)
+ /// .map_ok(|chunk| chunk.to_vec())
+ /// .try_concat();
/// ```
///
#[inline]
@@ -715,16 +687,12 @@ impl IpfsClient {
/// # Examples
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
/// use std::io::Cursor;
///
- /// # fn main() {
/// let client = IpfsClient::default();
/// let data = Cursor::new("Hello World!");
- /// let req = client.block_put(data);
- /// # }
+ /// let res = client.block_put(data);
/// ```
///
#[inline]
@@ -744,14 +712,10 @@ impl IpfsClient {
/// # Examples
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.block_rm("QmXdNSQx7nbdRvkjGCEQgVjVtVwsHvV8NmV2a8xzQVwuFA");
- /// # }
+ /// let res = client.block_rm("QmXdNSQx7nbdRvkjGCEQgVjVtVwsHvV8NmV2a8xzQVwuFA");
/// ```
///
#[inline]
@@ -764,14 +728,10 @@ impl IpfsClient {
/// # Examples
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.block_stat("QmXdNSQx7nbdRvkjGCEQgVjVtVwsHvV8NmV2a8xzQVwuFA");
- /// # }
+ /// let res = client.block_stat("QmXdNSQx7nbdRvkjGCEQgVjVtVwsHvV8NmV2a8xzQVwuFA");
/// ```
///
#[inline]
@@ -784,14 +744,10 @@ impl IpfsClient {
/// # Examples
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.bootstrap_add_default();
- /// # }
+ /// let res = client.bootstrap_add_default();
/// ```
///
#[inline]
@@ -806,14 +762,10 @@ impl IpfsClient {
/// # Examples
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.bootstrap_list();
- /// # }
+ /// let res = client.bootstrap_list();
/// ```
///
#[inline]
@@ -826,14 +778,10 @@ impl IpfsClient {
/// # Examples
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.bootstrap_rm_all();
- /// # }
+ /// let res = client.bootstrap_rm_all();
/// ```
///
#[inline]
@@ -846,17 +794,15 @@ impl IpfsClient {
/// # Examples
///
/// ```no_run
- /// # extern crate futures;
- /// # extern crate ipfs_api;
- /// #
- /// use futures::Stream;
+ /// use futures::TryStreamExt;
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
/// let hash = "QmXdNSQx7nbdRvkjGCEQgVjVtVwsHvV8NmV2a8xzQVwuFA";
- /// let req = client.cat(hash).concat2();
- /// # }
+ /// let res = client
+ /// .cat(hash)
+ /// .map_ok(|chunk| chunk.to_vec())
+ /// .try_concat();
/// ```
///
#[inline]
@@ -867,14 +813,10 @@ impl IpfsClient {
/// List available commands that the server accepts.
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.commands();
- /// # }
+ /// let res = client.commands();
/// ```
///
#[inline]
@@ -885,14 +827,10 @@ impl IpfsClient {
/// Opens the config file for editing (on the server).
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.config_edit();
- /// # }
+ /// let res = client.config_edit();
/// ```
///
#[inline]
@@ -903,16 +841,12 @@ impl IpfsClient {
/// Replace the config file.
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
/// use std::io::Cursor;
///
- /// # fn main() {
/// let client = IpfsClient::default();
/// let config = Cursor::new("{..json..}");
- /// let req = client.config_replace(config);
- /// # }
+ /// let res = client.config_replace(config);
/// ```
///
#[inline]
@@ -932,14 +866,10 @@ impl IpfsClient {
/// Returns an unparsed json string, due to an unclear spec.
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.config_show();
- /// # }
+ /// let res = client.config_show();
/// ```
///
#[inline]
@@ -950,14 +880,10 @@ impl IpfsClient {
/// Returns information about a dag node in Ipfs.
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.dag_get("QmXdNSQx7nbdRvkjGCEQgVjVtVwsHvV8NmV2a8xzQVwuFA");
- /// # }
+ /// let res = client.dag_get("QmXdNSQx7nbdRvkjGCEQgVjVtVwsHvV8NmV2a8xzQVwuFA");
/// ```
///
#[inline]
@@ -987,17 +913,12 @@ impl IpfsClient {
/// Query the DHT for all of the multiaddresses associated with a Peer ID.
///
/// ```no_run
- /// # extern crate futures;
- /// # extern crate ipfs_api;
- /// #
- /// use futures::Stream;
+ /// use futures::TryStreamExt;
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
/// let peer = "QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM";
- /// let req = client.dht_findpeer(peer).collect();
- /// # }
+ /// let res = client.dht_findpeer(peer).try_collect::<Vec<_>>();
/// ```
///
#[inline]
@@ -1008,17 +929,12 @@ impl IpfsClient {
/// Find peers in the DHT that can provide a specific value given a key.
///
/// ```no_run
- /// # extern crate futures;
- /// # extern crate ipfs_api;
- /// #
- /// use futures::Stream;
+ /// use futures::TryStreamExt;
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
/// let key = "QmXdNSQx7nbdRvkjGCEQgVjVtVwsHvV8NmV2a8xzQVwuFA";
- /// let req = client.dht_findprovs(key).collect();
- /// # }
+ /// let res = client.dht_findprovs(key).try_collect::<Vec<_>>();
/// ```
///
#[inline]
@@ -1029,17 +945,12 @@ impl IpfsClient {
/// Query the DHT for a given key.
///
/// ```no_run
- /// # extern crate futures;
- /// # extern crate ipfs_api;
- /// #
- /// use futures::Stream;
+ /// use futures::TryStreamExt;
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
/// let key = "QmXdNSQx7nbdRvkjGCEQgVjVtVwsHvV8NmV2a8xzQVwuFA";
- /// let req = client.dht_get(key).collect();
- /// # }
+ /// let res = client.dht_get(key).try_collect::<Vec<_>>();
/// ```
///
#[inline]
@@ -1050,17 +961,12 @@ impl IpfsClient {
/// Announce to the network that you are providing a given value.
///
/// ```no_run
- /// # extern crate futures;
- /// # extern crate ipfs_api;
- /// #
- /// use futures::Stream;
+ /// use futures::TryStreamExt;
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
/// let key = "QmXdNSQx7nbdRvkjGCEQgVjVtVwsHvV8NmV2a8xzQVwuFA";
- /// let req = client.dht_provide(key).collect();
- /// # }
+ /// let res = client.dht_provide(key).try_collect::<Vec<_>>();
/// ```
///
#[inline]
@@ -1071,16 +977,11 @@ impl IpfsClient {
/// Write a key/value pair to the DHT.
///
/// ```no_run
- /// # extern crate futures;
- /// # extern crate ipfs_api;
- /// #
- /// use futures::Stream;
+ /// use futures::TryStreamExt;
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.dht_put("test", "Hello World!").collect();
- /// # }
+ /// let res = client.dht_put("test", "Hello World!").try_collect::<Vec<_>>();
/// ```
///
#[inline]
@@ -1091,17 +992,12 @@ impl IpfsClient {
/// Find the closest peer given the peer ID by querying the DHT.
///
/// ```no_run
- /// # extern crate futures;
- /// # extern crate ipfs_api;
- /// #
- /// use futures::Stream;
+ /// use futures::TryStreamExt;
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
/// let peer = "QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM";
- /// let req = client.dht_query(peer).collect();
- /// # }
+ /// let res = client.dht_query(peer).try_collect::<Vec<_>>();
/// ```
///
#[inline]
@@ -1112,14 +1008,10 @@ impl IpfsClient {
/// Clear inactive requests from the log.
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.diag_cmds_clear();
- /// # }
+ /// let res = client.diag_cmds_clear();
/// ```
///
#[inline]
@@ -1130,14 +1022,10 @@ impl IpfsClient {
/// Set how long to keep inactive requests in the log.
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.diag_cmds_set_time("1m");
- /// # }
+ /// let res = client.diag_cmds_set_time("1m");
/// ```
///
#[inline]
@@ -1156,14 +1044,10 @@ impl IpfsClient {
/// an actual object.
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.diag_sys();
- /// # }
+ /// let res = client.diag_sys();
/// ```
///
#[inline]
@@ -1174,14 +1058,10 @@ impl IpfsClient {
/// Resolve DNS link.
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.dns("ipfs.io", true);
- /// # }
+ /// let res = client.dns("ipfs.io", true);
/// ```
///
#[inline]
@@ -1192,14 +1072,10 @@ impl IpfsClient {
/// List directory for Unix filesystem objects.
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.file_ls("/ipns/ipfs.io");
- /// # }
+ /// let res = client.file_ls("/ipns/ipfs.io");
/// ```
///
#[inline]
@@ -1210,14 +1086,10 @@ impl IpfsClient {
/// Copy files into MFS.
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.files_cp("/path/to/file", "/dest");
- /// # }
+ /// let res = client.files_cp("/path/to/file", "/dest");
/// ```
///
#[inline]
@@ -1233,15 +1105,11 @@ impl IpfsClient {
/// Flush a path's data to disk.
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.files_flush(None);
- /// let req = client.files_flush(Some("/tmp"));
- /// # }
+ /// let res = client.files_flush(None);
+ /// let res = client.files_flush(Some("/tmp"));
/// ```
///
#[inline]
@@ -1255,15 +1123,11 @@ impl IpfsClient {
/// List directories in MFS.
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.files_ls(None);
- /// let req = client.files_ls(Some("/tmp"));
- /// # }
+ /// let res = client.files_ls(None);
+ /// let res = client.files_ls(Some("/tmp"));
/// ```
///
#[inline]
@@ -1274,15 +1138,11 @@ impl IpfsClient {
/// Make directories in MFS.
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.files_mkdir("/test", false);
- /// let req = client.files_mkdir("/test/nested/dir", true);
- /// # }
+ /// let res = client.files_mkdir("/test", false);
+ /// let res = client.files_mkdir("/test/nested/dir", true);
/// ```
///
#[inline]
@@ -1298,14 +1158,10 @@ impl IpfsClient {
/// Copy files into MFS.
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.files_mv("/test/tmp.json", "/test/file.json");
- /// # }
+ /// let res = client.files_mv("/test/tmp.json", "/test/file.json");
/// ```
///
#[inline]
@@ -1321,14 +1177,10 @@ impl IpfsClient {
/// Read a file in MFS.
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.files_read("/test/file.json");
- /// # }
+ /// let res = client.files_read("/test/file.json");
/// ```
///
#[inline]
@@ -1339,15 +1191,11 @@ impl IpfsClient {
/// Remove a file in MFS.
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.files_rm("/test/dir", true);
- /// let req = client.files_rm("/test/file.json", false);
- /// # }
+ /// let res = client.files_rm("/test/dir", true);
+ /// let res = client.files_rm("/test/file.json", false);
/// ```
///
#[inline]
@@ -1363,14 +1211,10 @@ impl IpfsClient {
/// Display a file's status in MDFS.
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.files_stat("/test/file.json");
- /// # }
+ /// let res = client.files_stat("/test/file.json");
/// ```
///
#[inline]
@@ -1381,16 +1225,12 @@ impl IpfsClient {
/// Write to a mutable file in the filesystem.
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
/// use std::fs::File;
///
- /// # fn main() {
/// let client = IpfsClient::default();
/// let file = File::open("test.json").unwrap();
- /// let req = client.files_write("/test/file.json", true, true, file);
- /// # }
+ /// let res = client.files_write("/test/file.json", true, true, file);
/// ```
///
#[inline]
@@ -1422,14 +1262,10 @@ impl IpfsClient {
/// List blocks that are both in the filestore and standard block storage.
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.filestore_dups();
- /// # }
+ /// let res = client.filestore_dups();
/// ```
///
#[inline]
@@ -1440,14 +1276,12 @@ impl IpfsClient {
/// List objects in filestore.
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.filestore_ls(Some("QmYPP3BovR2m8UqCZxFbdXSit6SKgExxDkFAPLqiGsap4X"));
- /// # }
+ /// let res = client.filestore_ls(
+ /// Some("QmYPP3BovR2m8UqCZxFbdXSit6SKgExxDkFAPLqiGsap4X")
+ /// );
/// ```
///
#[inline]
@@ -1461,14 +1295,10 @@ impl IpfsClient {
/// Verify objects in filestore.
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.filestore_verify(None);
- /// # }
+ /// let res = client.filestore_verify(None);
/// ```
///
#[inline]
@@ -1482,14 +1312,10 @@ impl IpfsClient {
/// Download Ipfs object.
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.get("/test/file.json");
- /// # }
+ /// let res = client.get("/test/file.json");
/// ```
///
#[inline]
@@ -1502,15 +1328,11 @@ impl IpfsClient {
/// If `peer` is `None`, returns information about you.
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.id(None);
- /// let req = client.id(Some("QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM"));
- /// # }
+ /// let res = client.id(None);
+ /// let res = client.id(Some("QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM"));
/// ```
///
#[inline]
@@ -1521,14 +1343,10 @@ impl IpfsClient {
/// Create a new keypair.
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::{IpfsClient, KeyType};
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.key_gen("test", KeyType::Rsa, 64);
- /// # }
+ /// let res = client.key_gen("test", KeyType::Rsa, 64);
/// ```
///
#[inline]
@@ -1545,14 +1363,10 @@ impl IpfsClient {
/// List all local keypairs.
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.key_list();
- /// # }
+ /// let res = client.key_list();
/// ```
///
#[inline]
@@ -1563,14 +1377,10 @@ impl IpfsClient {
/// Rename a keypair.
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.key_rename("key_0", "new_name", false);
- /// # }
+ /// let res = client.key_rename("key_0", "new_name", false);
/// ```
///
#[inline]
@@ -1587,14 +1397,10 @@ impl IpfsClient {
/// Remove a keypair.
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.key_rm("key_0");
- /// # }
+ /// let res = client.key_rm("key_0");
/// ```
///
#[inline]
@@ -1605,18 +1411,15 @@ impl IpfsClient {
/// Change the logging level for a logger.
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::{IpfsClient, Logger, LoggingLevel};
/// use std::borrow::Cow;
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.log_level(Logger::All, LoggingLevel::Debug);
- /// let req = client.log_level(
+ /// let res = client.log_level(Logger::All, LoggingLevel::Debug);
+ /// let res = client.log_level(
/// Logger::Specific(Cow::Borrowed("web")),
- /// LoggingLevel::Warning);
- /// # }
+ /// LoggingLevel::Warning
+ /// );
/// ```
///
#[inline]
@@ -1632,14 +1435,10 @@ impl IpfsClient {
/// List all logging subsystems.
///
/// ```no_run
- /// # extern crate ipfs_api;
- /// #
/// use ipfs_api::IpfsClient;
///
- /// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.log_ls();
- /// # }
+ /// let res = client.log_ls();
/// ```
///
#[inline]
@@ -1657,7 +1456,7 @@ impl IpfsClient {
///
/// # fn main() {
/// let client = IpfsClient::default();
- /// let req = client.log_