Struct trackable::History [−][src]
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 "#);
Implementations
impl<Event> History<Event>
[src]
pub fn new() -> History<Event>
[src]
Makes an empty history.
pub fn add(&mut self, event: Event)
[src]
Adds an event to the tail of this history.
pub fn events(&self) -> &[Event]
[src]
Returns the tracked events in this history.
Trait Implementations
impl<Event> Clone for History<Event> where
Event: Clone,
[src]
Event: Clone,
impl<Event> Debug for History<Event> where
Event: Debug,
[src]
Event: Debug,
impl<Event> Default for History<Event>
[src]
impl<'de, Event> Deserialize<'de> for History<Event> where
Event: Deserialize<'de>,
[src]
Event: Deserialize<'de>,
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<History<Event>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
[src]
__deserializer: __D
) -> Result<History<Event>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
impl<Event> Display for History<Event> where
Event: Display,
[src]
Event: Display,
impl<Event> Serialize for History<Event> where
Event: Serialize,
[src]
Event: Serialize,
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
[src]
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Auto Trait Implementations
impl<Event> RefUnwindSafe for History<Event> where
Event: RefUnwindSafe,
Event: RefUnwindSafe,
impl<Event> Send for History<Event> where
Event: Send,
Event: Send,
impl<Event> Sync for History<Event> where
Event: Sync,
Event: Sync,
impl<Event> Unpin for History<Event> where
Event: Unpin,
Event: Unpin,
impl<Event> UnwindSafe for History<Event> where
Event: UnwindSafe,
Event: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,