1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use support_lifeline::task::TaskStack;

use crate::bridge::TemplateTaskBus;
use crate::service::some::SomeService;

#[derive(Debug)]
pub struct TemplateTask {
    stack: TaskStack<TemplateTaskBus>,
}

impl TemplateTask {
    pub fn new() -> color_eyre::Result<Self> {
        let bus = TemplateTaskBus::default();
        let mut stack = TaskStack::new(bus);
        stack.spawn_service::<SomeService>()?;
        Ok(Self { stack })
    }
}

impl TemplateTask {
    pub fn stack(&self) -> &TaskStack<TemplateTaskBus> {
        &self.stack
    }
}