From 4cb3884e24b3cba3347ff93475bbabd6fe18d2fa Mon Sep 17 00:00:00 2001 From: HampusM Date: Fri, 22 Jul 2022 13:25:45 +0200 Subject: refactor: make factories an optional feature --- examples/factory/interfaces/mod.rs | 1 + examples/factory/interfaces/user.rs | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 examples/factory/interfaces/mod.rs create mode 100644 examples/factory/interfaces/user.rs (limited to 'examples/factory/interfaces') diff --git a/examples/factory/interfaces/mod.rs b/examples/factory/interfaces/mod.rs new file mode 100644 index 0000000..22d12a3 --- /dev/null +++ b/examples/factory/interfaces/mod.rs @@ -0,0 +1 @@ +pub mod user; diff --git a/examples/factory/interfaces/user.rs b/examples/factory/interfaces/user.rs new file mode 100644 index 0000000..70cd632 --- /dev/null +++ b/examples/factory/interfaces/user.rs @@ -0,0 +1,13 @@ +use syrette::factory; +use syrette::interfaces::factory::IFactory; + +pub trait IUser +{ + fn get_name(&self) -> &'static str; + fn get_date_of_birth(&self) -> &'static str; + fn get_password(&self) -> &'static str; +} + +#[factory] +pub type IUserFactory = + dyn IFactory<(&'static str, &'static str, &'static str), dyn IUser>; -- cgit v1.2.3-18-g5258