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]
fn new() -> Self
Makes an empty history.
fn add(&mut self, event: Event)
Adds an event to the tail of this history.
fn events(&self) -> &[Event]
Returns the tracked events in this history.
Trait Implementations
impl<Event: Debug> Debug for History<Event>
[src]
impl<Event: Clone> Clone for History<Event>
[src]
fn clone(&self) -> History<Event>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more