Skip to content

Commit

Permalink
docs: add module documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
knsd committed Dec 6, 2017
1 parent 3c7ce8c commit 21ffc9a
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
//! tokio-ping is an asynchronous ICMP pinging library.
//!
//! The repository is located at https://github.com/knsd/tokio-ping/.
//!
//! # Usage example
//!
//! Note, sending and receiving ICMP packets requires privileges.
//!
//! ```
//! extern crate futures;
//! extern crate tokio_core;
//! extern crate tokio_ping;
//!
//! use futures::Stream;
//!
//! fn main() {
//! let addr = std::env::args().nth(1).unwrap().parse().unwrap();
//!
//! let mut reactor = tokio_core::reactor::Core::new().unwrap();
//! let pinger = tokio_ping::Pinger::new(&reactor.handle()).unwrap();
//! let stream = pinger.chain(addr).stream();
//!
//! let future = stream.take(3).for_each(|mb_time| {
//! match mb_time {
//! Some(time) => println!("time={}", time),
//! None => println!("timeout"),
//! }
//! Ok(())
//! });
//!
//! reactor.run(future).unwrap_or_default();
//! }
//!
//! ```
#[macro_use] extern crate error_chain;
extern crate futures;
extern crate lazy_socket;
Expand Down

0 comments on commit 21ffc9a

Please sign in to comment.