aboutsummaryrefslogtreecommitdiff
path: root/examples/with-3rd-party/ninja.rs
blob: 945adf0a54e87a29ac01668565ac0a9e412e3ab1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use syrette::{injectable, ptr::TransientPtr};
use third_party_lib::IShuriken;

use crate::interfaces::ninja::INinja;

pub struct Ninja
{
    shuriken: TransientPtr<dyn IShuriken>,
}

#[injectable(INinja)]
impl Ninja
{
    pub fn new(shuriken: TransientPtr<dyn IShuriken>) -> Self
    {
        Self { shuriken }
    }
}

impl INinja for Ninja
{
    fn throw_shuriken(&self)
    {
        self.shuriken.throw();
    }
}