aboutsummaryrefslogtreecommitdiff
path: root/examples/with-3rd-party/ninja.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-08-20 17:10:08 +0200
committerHampusM <hampus@hampusmat.com>2022-08-21 18:17:50 +0200
commitade21185976ea2324d313a5c28a88cc0492f2934 (patch)
treef217d55ad324160d8a9a099c562c8bc6cbb60c1f /examples/with-3rd-party/ninja.rs
parentb31422d48a600ccccb682567f5eb11fc0bca547c (diff)
docs: add a example that uses a 3rd party library
Diffstat (limited to 'examples/with-3rd-party/ninja.rs')
-rw-r--r--examples/with-3rd-party/ninja.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/examples/with-3rd-party/ninja.rs b/examples/with-3rd-party/ninja.rs
new file mode 100644
index 0000000..945adf0
--- /dev/null
+++ b/examples/with-3rd-party/ninja.rs
@@ -0,0 +1,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();
+ }
+}