summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Eizinger <thomas@eizinger.io>2019-12-10 15:53:22 +0100
committerDoug Tangren <d.tangren@gmail.com>2019-12-10 09:53:22 -0500
commit596aed17bd6d48eecca97ecc1818075e21b63bbf (patch)
tree02c8283e3e6b597c500f0cff60ae81f417bf24fd
parenteb1ad605157b14fc9e1329b617aea8012abde1c9 (diff)
Replace invalid example in README with cargo example (#207)
The example in the README is outdated and no longer compiles. To prevent this from happening again, this patch removes the example entirely and instead introduces a new example `custom_host` that will be checked during `cargo test`. Fixes #183.
-rw-r--r--README.md20
-rw-r--r--examples/custom_host.rs13
2 files changed, 13 insertions, 20 deletions
diff --git a/README.md b/README.md
index 90899fe..41f9c1d 100644
--- a/README.md
+++ b/README.md
@@ -15,26 +15,6 @@ shiplift = "0.6"
## usage
-### communicating with hosts
-
-To use shiplift, you must first have a docker daemon readily accessible. Typically this daemon process
-is resolvable via a url specified by an env var named `DOCKER_HOST`.
-
-```rust
-let docker = shiplift::Docker::new();
-```
-
-If you wish to be more explicit you can provide a host in the form of a `url.Url`.
-
-```rust
-use shiplift::Docker;
-use url::Url;
-
-let docker = Docker::host(Url::parse("http://yourhost").unwrap());
-```
-
-### Examples
-
Many small runnable example programs can be found in this repository's [examples directory](https://github.com/softprops/shiplift/tree/master/examples).
## planned changes
diff --git a/examples/custom_host.rs b/examples/custom_host.rs
new file mode 100644
index 0000000..3b1fd3e
--- /dev/null
+++ b/examples/custom_host.rs
@@ -0,0 +1,13 @@
+use futures::Future;
+use shiplift::Docker;
+
+fn main() {
+ let docker = Docker::host("http://yourhost".parse().unwrap());
+
+ let fut = docker
+ .ping()
+ .map(|pong| println!("Ping: {}", pong))
+ .map_err(|e| eprintln!("Error: {}", e));
+
+ tokio::run(fut);
+}