From e210a95b9724bf9c471090d629c5962e3e411711 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sat, 17 Sep 2022 18:37:30 +0200 Subject: docs: add missing modules in the async example --- examples/async/food.rs | 19 +++++++++++++++++++ examples/async/interfaces/food.rs | 10 ++++++++++ 2 files changed, 29 insertions(+) create mode 100644 examples/async/food.rs create mode 100644 examples/async/interfaces/food.rs (limited to 'examples/async') diff --git a/examples/async/food.rs b/examples/async/food.rs new file mode 100644 index 0000000..c2264cf --- /dev/null +++ b/examples/async/food.rs @@ -0,0 +1,19 @@ +use crate::interfaces::food::IFood; + +pub struct Food {} + +impl Food +{ + pub fn new() -> Self + { + Self {} + } +} + +impl IFood for Food +{ + fn eat(&self) + { + println!("Ate food"); + } +} diff --git a/examples/async/interfaces/food.rs b/examples/async/interfaces/food.rs new file mode 100644 index 0000000..b310a3d --- /dev/null +++ b/examples/async/interfaces/food.rs @@ -0,0 +1,10 @@ +use syrette::factory; +use syrette::ptr::TransientPtr; + +pub trait IFood +{ + fn eat(&self); +} + +#[factory(threadsafe = true)] +pub type IFoodFactory = dyn Fn() -> TransientPtr; -- cgit v1.2.3-18-g5258