From 12acab96a7d9ba8032378f8be7b6932f4406a849 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sat, 20 Aug 2022 17:40:02 +0200 Subject: docs: simplify with-3rd-party example --- examples/with-3rd-party/bootstrap.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'examples/with-3rd-party/bootstrap.rs') diff --git a/examples/with-3rd-party/bootstrap.rs b/examples/with-3rd-party/bootstrap.rs index e51c104..1ab3192 100644 --- a/examples/with-3rd-party/bootstrap.rs +++ b/examples/with-3rd-party/bootstrap.rs @@ -1,7 +1,7 @@ use syrette::errors::di_container::BindingBuilderError; use syrette::ptr::TransientPtr; use syrette::{declare_default_factory, DIContainer}; -use third_party_lib::{IShuriken, Shuriken}; +use third_party_lib::Shuriken; // Interfaces use crate::interfaces::ninja::INinja; @@ -9,7 +9,7 @@ use crate::interfaces::ninja::INinja; // Concrete implementations use crate::ninja::Ninja; -declare_default_factory!(IShuriken); +declare_default_factory!(Shuriken); pub fn bootstrap() -> error_stack::Result { @@ -18,13 +18,8 @@ pub fn bootstrap() -> error_stack::Result di_container.bind::().to::()?; di_container - .bind::() - .to_default_factory(&|| { - let shuriken: TransientPtr = - TransientPtr::new(Shuriken::new()); - - shuriken - })?; + .bind::() + .to_default_factory(&|| TransientPtr::new(Shuriken::new()))?; Ok(di_container) } -- cgit v1.2.3-18-g5258