From 499713a1d63564be320030dc98b3879b66390bb8 Mon Sep 17 00:00:00 2001 From: seancarroll Date: Sun, 10 Jan 2021 21:09:57 -0600 Subject: improve rust docs --- src/lib.rs | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 575e4cf..2b64b9d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,18 +3,16 @@ //! Dotavious provides bindings to generate [DOT](https://graphviz.org/doc/info/lang.html) //! code used by the Graphviz (http://graphviz.org/) for visualising graphs. +//! Provides strongly typed attribute functions and offers almost complete +//! coverage of all Graphviz attributes and syntax //! -//! Main features of the graphviz library include: -//! * Almost complete coverage of all Graphviz attributes and syntax. +//! # Examples //! -//! # Example +//! First example provides a basic directed graph: +//! 2 nodes connected by a single edge //! //! ```rust -//! use dotavious::attributes::{AttributeText, GraphAttributeStatementBuilder, GraphAttributes}; -//! use dotavious::{ -//! Dot, Edge, EdgeAttributeStatementBuilder, EdgeAttributes, EdgeBuilder, Graph, -//! GraphBuilder, Node, NodeAttributeStatementBuilder, NodeAttributes, NodeBuilder, -//! }; +//! use dotavious::{Dot, Edge, Graph, GraphBuilder, Node}; //! use std::io; //! use std::io::Read; //! @@ -41,6 +39,28 @@ //! N0 -> N1; //! } //! ``` +//! +//! Second example provides a more complex graph showcasing +//! Dotavious' various builders and strongly typed attribute +//! functions. +//! +//! ```rust +//! use dotavious::attributes::{ +//! AttributeText, Color, CompassPoint, EdgeStyle, GraphAttributeStatementBuilder, +//! GraphAttributes, NodeStyle, PortPosition, RankDir, Shape, +//! }; +//! use dotavious::{ +//! Dot, Edge, EdgeAttributeStatementBuilder, EdgeAttributes, EdgeBuilder, Graph, +//! GraphBuilder, Node, NodeAttributeStatementBuilder, NodeAttributes, NodeBuilder, +//! }; +//! use std::io; +//! use std::io::Read; +//! ``` +//! +//! Produces +//! ```dot +//! +//! ``` pub mod attributes; pub mod dot; -- cgit v1.2.3