pub struct Logger<T: IntoRunCondition> { /* private fields */ }
Expand description
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§
Source§impl<T: IntoRunCondition> Logger<T>
impl<T: IntoRunCondition> Logger<T>
Sourcepub fn completed(&self) -> bool
pub fn completed(&self) -> bool
Returns true
if last call to select
was completed and false
if it was
cancelled by the run condition.
Sourcepub fn duration(&self) -> Duration
pub fn duration(&self) -> Duration
Returns the total time spend during the last call to select
.
Sourcepub fn into_inner(self) -> T::RunCondition
pub fn into_inner(self) -> T::RunCondition
consumes self
and returns the wrapped condition
Trait Implementations§
Source§impl<T: IntoRunCondition> Debug for Logger<T>where
T::RunCondition: Debug,
impl<T: IntoRunCondition> Debug for Logger<T>where
T::RunCondition: Debug,
Source§impl<'a, T: IntoRunCondition> IntoRunCondition for &'a mut Logger<T>
impl<'a, T: IntoRunCondition> IntoRunCondition for &'a mut Logger<T>
type RunCondition = InnerLogger<'a, T>
Source§fn into_run_condition(self) -> InnerLogger<'a, T>
fn into_run_condition(self) -> InnerLogger<'a, T>
consumes
self
and returns a RunCondition
.Auto Trait Implementations§
impl<T> Freeze for Logger<T>
impl<T> RefUnwindSafe for Logger<T>
impl<T> Send for Logger<T>
impl<T> Sync for Logger<T>
impl<T> Unpin for Logger<T>
impl<T> UnwindSafe for Logger<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more