Struct rain::Graph [] [src]

pub struct Graph<V> { /* fields omitted */ }

The graph drawing structure

Methods

impl<V> Graph<V> where V: Clone + Default + Ord + PartialEq + Debug,
        f64: From<V>
[src]

Create a new Graph for drawing

Example

use rain::Graph;

let _ :Graph<u8> = Graph::new();

Create a new Graph for drawing with a custom length of the identifier (prefix)

Example

use rain::Graph;

let _ :Graph<u8> = Graph::with_prefix_length(25);

Set the global log level for reporting

Add a data value to the graph by some identifier which can be displayed somehow.

Example

use rain::Graph;

let mut graph = Graph::new();
let line = graph.add("Line 1", 0).unwrap();

assert_eq!(line, "Line 1");

Remove a line from the graph

Example

use rain::Graph;

let mut graph = Graph::new();
let line = graph.add("Line 1", 0).unwrap();

let removed_line = graph.remove(line).unwrap();
assert_eq!(removed_line, "Line 1");

Prints the graph

Example

use rain::Graph;

let mut graph = Graph::new();

assert!(graph.add("Line 1", 0).is_ok());
assert!(graph.add("Line 2", 0).is_ok());

graph.print();

Print only if new data is available. Returns an indicator if somethings was printed or not.

Example

use rain::Graph;

let mut graph = Graph::new();

assert!(graph.add("Line 1", 0).is_ok());
assert!(graph.add("Line 2", 0).is_ok());

graph.print_if_new_data();
graph.print_if_new_data();