summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2019-09-21 19:51:32 +0300
committerLars Wirzenius <liw@liw.fi>2019-09-21 19:51:32 +0300
commit07e49973baac0e9db3ee5b1deffb0224aca5c915 (patch)
treebea52707745ad5a8f7bf8c1939cd94f2ee861c70 /src
parent842f41c5c8f188cad1e21551c7330b2d4ab8069b (diff)
downloadroadmap-07e49973baac0e9db3ee5b1deffb0224aca5c915.tar.gz
Change: docstrings
Diffstat (limited to 'src')
-rw-r--r--src/bin/roadmap2dot.rs13
-rw-r--r--src/lib.rs35
2 files changed, 26 insertions, 22 deletions
diff --git a/src/bin/roadmap2dot.rs b/src/bin/roadmap2dot.rs
index bb27a5f..4e40bc6 100644
--- a/src/bin/roadmap2dot.rs
+++ b/src/bin/roadmap2dot.rs
@@ -1,3 +1,16 @@
+//! Command line program to convert a roadmap from a named YAML input
+//! file to SVG, written to the standard output.
+//!
+//! Example
+//!
+//! ~~~sh
+//! roadmap2svg foo.yaml > foo.svg
+//! ~~~
+//!
+//! The command line program mostly exists just to make it easier to
+//! test the library crate. It is expected that serious use of the
+//! crate will be as a library.
+
use roadmap::Roadmap;
use structopt::StructOpt;
use std::path::PathBuf;
diff --git a/src/lib.rs b/src/lib.rs
index 9d45ca4..a5422ab 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -11,29 +11,20 @@
//! ```
//! # use roadmap::Step;
//! # fn main() -> std::result::Result<(), Box<dyn std::error::Error>> {
-//! let mut r = roadmap::Roadmap::new();
-//! assert_eq!(r.step_names().len(), 0);
+//! let mut r = roadmap::Roadmap::from_yaml("
+//! endgoal:
+//! label: The end goal
+//! depends:
+//! - first
+//! first:
+//! label: The first step
+//! ").unwrap();
//!
-//! let mut endgoal = roadmap::Step::new("endgoal", "the end goal");
-//! endgoal.add_dependency("first");
-//! assert_eq!(endgoal.name(), "endgoal");
-//! assert_eq!(endgoal.label(), "the end goal");
-//! let deps: Vec<&String> = endgoal.dependencies().collect();
-//! assert_eq!(deps, vec!["first"]);
-//!
-//! let first = roadmap::Step::new("first", "the first step");
-//!
-//! r.add_step(&endgoal)?;
-//! assert_eq!(r.step_names().len(), 1);
-//! r.add_step(&first)?;
-//! assert_eq!(r.step_names().len(), 2);
-//!
-//! assert_eq!(r.as_dot()?, r#"digraph "roadmap" {
-//! endgoal [label="the end goal"];
-//! first [label="the first step"];
-//! first -> endgoal;
-//! }
-//! "#.to_string());
+//! let n = r.step_names();
+//! assert_eq!(n.len(), 2);
+//! assert!(n.contains(&"first"));
+//! assert!(n.contains(&"endgoal"));
+//!
//! # Ok(())
//! # }
//! ```