[−][src]Struct rubot::Logger
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]
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]
T::RunCondition: Debug,
impl<'a, T: IntoRunCondition> IntoRunCondition for &'a mut Logger<T>
[src]
type RunCondition = InnerLogger<'a, T>
fn into_run_condition(self) -> InnerLogger<'a, T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Logger<T> where
<T as IntoRunCondition>::RunCondition: RefUnwindSafe,
<T as IntoRunCondition>::RunCondition: RefUnwindSafe,
impl<T> Send for Logger<T> where
<T as IntoRunCondition>::RunCondition: Send,
<T as IntoRunCondition>::RunCondition: Send,
impl<T> Sync for Logger<T> where
<T as IntoRunCondition>::RunCondition: Sync,
<T as IntoRunCondition>::RunCondition: Sync,
impl<T> Unpin for Logger<T> where
<T as IntoRunCondition>::RunCondition: Unpin,
<T as IntoRunCondition>::RunCondition: Unpin,
impl<T> UnwindSafe for Logger<T> where
<T as IntoRunCondition>::RunCondition: UnwindSafe,
<T as IntoRunCondition>::RunCondition: 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,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Tap for T
[src]
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.
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>,