Struct trackable::History [] [src]

pub struct History<Event>(_);

The tracking history of a target.

A history is a sequence of the tracked events.

Examples

use std::fmt::{Display, Formatter, Result};
use trackable::History;

struct Event(&'static str);
impl Display for Event {
    fn fmt(&self, f: &mut Formatter) -> Result {
        write!(f, "event: {}", self.0)
    }
}

let mut history = History::new();
history.add(Event("foo"));
history.add(Event("bar"));

assert_eq!(format!("\n{}", history), r#"
HISTORY:
  [0] event: foo
  [1] event: bar
"#);

Methods

impl<Event> History<Event>
[src]

Makes an empty history.

Adds an event to the tail of this history.

Returns the tracked events in this history.

Trait Implementations

impl<Event: Debug> Debug for History<Event>
[src]

Formats the value using the given formatter.

impl<Event: Clone> Clone for History<Event>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<Event: Display> Display for History<Event>
[src]

Formats the value using the given formatter. Read more