task: derive Debug
This commit is contained in:
parent
c096d83ab3
commit
873954d596
@ -1,6 +1,6 @@
|
|||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
pub trait Task {
|
pub trait Task: std::fmt::Debug {
|
||||||
fn tick(&mut self) {}
|
fn tick(&mut self) {}
|
||||||
fn start(&mut self) {}
|
fn start(&mut self) {}
|
||||||
fn stop(&mut self) {}
|
fn stop(&mut self) {}
|
||||||
@ -123,6 +123,7 @@ impl ScheduledTask {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct Scheduler {
|
pub struct Scheduler {
|
||||||
tasks: Vec<ScheduledTask>,
|
tasks: Vec<ScheduledTask>,
|
||||||
}
|
}
|
||||||
@ -131,7 +132,7 @@ impl Scheduler {
|
|||||||
pub fn new(tasks: Vec<Box<dyn Task>>) -> Self {
|
pub fn new(tasks: Vec<Box<dyn Task>>) -> Self {
|
||||||
let mut scheduled = Vec::new();
|
let mut scheduled = Vec::new();
|
||||||
for task in tasks {
|
for task in tasks {
|
||||||
log::info!("Scheduling task {:?}", task.name());
|
log::info!("Scheduling task {} {:?}", task.name(), task);
|
||||||
scheduled.push(ScheduledTask::new(task));
|
scheduled.push(ScheduledTask::new(task));
|
||||||
}
|
}
|
||||||
Scheduler {
|
Scheduler {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user