Committing the current files prior to reformatting.

This commit is contained in:
Jason Travis Smith 2016-06-27 18:24:48 -04:00
parent 455f873f2a
commit 446b92bea5

View File

@ -1,18 +1,74 @@
extern crate apprentice; #[macro_use]
extern crate scribe;
extern crate apprentice;
use apprentice::*; use apprentice::*;
struct TestTask
{
count: u8
}
impl TestTask
{
pub fn new() -> TestTask
{
TestTask
{
count: 0
}
}
}
impl Task for TestTask
{
fn get_name(&self) -> &str
{
"TestTask"
}
fn get_mortality(&self) -> Mortality
{
Mortality::Mortal
}
fn get_priority(&self) -> Priority
{
Priority::Normal
}
fn reset(&mut self)
{
self.count = 0;
}
fn process(&mut self, spawner: &mut Spawner) -> bool
{
self.count += 1;
println!("{}: {}", self.get_name(), self.count);
if self.count > 2
{
return true;
}
false
}
}
pub fn main() pub fn main()
{ {
let mut scheduler: Scheduler; let mut scheduler: Scheduler;
scheduler = Scheduler::new(None, Some(4)); scheduler = Scheduler::new(None, Some(4));
scheduler.queue_task(Task::new("Test")); scheduler.queue_task(TestTask::new());
scheduler.process_tasks(true); loop
scheduler.process_tasks(true); {
//scheduler.process_tasks(true); scheduler.process_tasks(true);
}
} }