[][src]Struct rain::Graph

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]

pub fn new() -> Self
[src]

Create a new Graph for drawing

Example

use rain::Graph;

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

pub fn with_prefix_length(length: usize) -> Self
[src]

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);

pub fn set_log_level(self, level: LevelFilter) -> Self
[src]

Set the global log level for reporting

pub fn add<T>(&mut self, identifier: T, value: V) -> Fallible<T> where
    T: Display
[src]

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");

pub fn remove<T>(&mut self, identifier: T) -> Fallible<T> where
    T: Display
[src]

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");

pub fn print(&mut self) -> Fallible<()>
[src]

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();

Auto Trait Implementations

impl<V> Send for Graph<V> where
    V: Send

impl<V> Sync for Graph<V> where
    V: Sync

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]