[][src]Struct dsa::commands::Tracker

pub struct Tracker<'a> { /* fields omitted */ }

A generic tracker for a property during a cli session.

Examples

let mut health = Tracker::new_action("health",10,10);
let matches = health.usage().get_matches_from_safe(&["health","-s","5"]).unwrap();
let output = health.call(&hero,&matches).unwrap();
assert_eq!(output.len(), 1);
if let Output::Gauge { name, current, max } = &output[0] {
    assert_eq!("health", name);
    assert_eq!(5, *current);
    assert_eq!(10, *max);
}

Methods

impl<'a> Tracker<'a>[src]

pub fn new_action(
    name: &'static str,
    current: isize,
    max: isize
) -> Box<dyn Action>
[src]

Trait Implementations

impl<'_> Action for Tracker<'_>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Tracker<'a>

impl<'a> Send for Tracker<'a>

impl<'a> Sync for Tracker<'a>

impl<'a> Unpin for Tracker<'a>

impl<'a> UnwindSafe for Tracker<'a>

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]