diff options
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 44 |
1 files changed, 43 insertions, 1 deletions
@@ -1,8 +1,50 @@ -//! Simple graphviz dot file format output. +#![doc(html_root_url = "https://docs.rs/dotavious/0.1.0")] +#![cfg_attr(docsrs, deny(broken_intra_doc_links))] + +//! Dotavious provides bindings to generate [DOT](https://graphviz.org/doc/info/lang.html) +//! code used by the Graphviz (http://graphviz.org/) for visualising graphs. +//! +//! Main features of the graphviz library include: +//! * Almost complete coverage of all Graphviz attributes and syntax. +//! +//! # Example +//! +//! ```rust +//! use dotavious::attributes::{AttributeText, GraphAttributeStatementBuilder, GraphAttributes}; +//! use dotavious::{ +//! Dot, Edge, EdgeAttributeStatementBuilder, EdgeAttributes, EdgeBuilder, Graph, +//! GraphBuilder, Node, NodeAttributeStatementBuilder, NodeAttributes, NodeBuilder, +//! }; +//! use std::io; +//! use std::io::Read; +//! +//! let g = GraphBuilder::new_directed(Some("single_edge".to_string())) +//! .add_node(Node::new("N0".to_string())) +//! .add_node(Node::new("N1".to_string())) +//! .add_edge(Edge::new("N0".to_string(), "N1".to_string())) +//! .build(); +//! +//! let mut writer= Vec::new(); +//! let dot = Dot { graph: g }; +//! dot.render(&mut writer).unwrap(); +//! +//! // output to graphviz DOT formatted string +//! let mut dot_string = String::new(); +//! Read::read_to_string(&mut &*writer, &mut dot_string).unwrap(); +//! println!("{}", dot_string); +//! +//! // digraph graph_attributes { +//! // N0; +//! // N1; +//! // N0 -> N1; +//! // } +//! ``` + pub mod attributes; pub mod dot; +#[doc(hidden)] pub use crate::dot::{ Dot, DotString, Edge, EdgeAttributeStatementBuilder, EdgeAttributes, EdgeBuilder, Graph, GraphBuilder, Node, NodeAttributeStatementBuilder, NodeAttributes, |