[][src]Struct rubot::Logger

pub struct Logger<T: IntoRunCondition> { /* fields omitted */ }

A struct implementing IntoRunCondition which can be used to log a call to select. For more details you can visit the individual methods.

Examples

let tree = Node::root().with_children(&[
    Node::new(false, 7).with_children(&[
        Node::new(true, 4),
        Node::new(true, 2),
    ]),
    Node::new(false, 5).with_children(&[
        Node::new(true, 8),
        Node::new(true, 9)
    ]),
]);

let mut bot = Bot::new(true);
let mut logger = Logger::new(ToCompletion);
assert_eq!(bot.select(&tree, &mut logger), Some(1));

assert_eq!(logger.depth(), 2);
// the total duration of `bot.select`
assert!(logger.duration() < Duration::from_secs(1));

Implementations

impl<T: IntoRunCondition> Logger<T>[src]

pub fn new(condition: T) -> Self[src]

Creates a new Logger wrapping condition.

pub fn steps(&self) -> u32[src]

Returns the total amount of times step was called during the last call to select.

pub fn depth(&self) -> u32[src]

Returns the deepest completed depth of the last call to select.

pub fn completed(&self) -> bool[src]

Returns true if last call to select was completed and false if it was cancelled by the run condition.

pub fn duration(&self) -> Duration[src]

Returns the total time spend during the last call to select.

pub fn into_inner(self) -> T::RunCondition[src]

consumes self and returns the wrapped condition

Trait Implementations

impl<T: IntoRunCondition> Debug for Logger<T> where
    T::RunCondition: Debug
[src]

impl<'a, T: IntoRunCondition> IntoRunCondition for &'a mut Logger<T>[src]

type RunCondition = InnerLogger<'a, T>

Auto Trait Implementations

impl<T> RefUnwindSafe for Logger<T> where
    <T as IntoRunCondition>::RunCondition: RefUnwindSafe

impl<T> Send for Logger<T> where
    <T as IntoRunCondition>::RunCondition: Send

impl<T> Sync for Logger<T> where
    <T as IntoRunCondition>::RunCondition: Sync

impl<T> Unpin for Logger<T> where
    <T as IntoRunCondition>::RunCondition: Unpin

impl<T> UnwindSafe for Logger<T> where
    <T as IntoRunCondition>::RunCondition: UnwindSafe

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> Tap for 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.