From 8c66b98bca6ed0a2990903fe8e0ea72def5c7be8 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 21 Aug 2022 14:19:07 +0200 Subject: refactor!: change errors to be more sane BREAKING CHANGE: Major improvements have been made to error types and the error_stack crate is no longer used --- src/provider.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/provider.rs') diff --git a/src/provider.rs b/src/provider.rs index e12a12a..ad94589 100644 --- a/src/provider.rs +++ b/src/provider.rs @@ -1,12 +1,13 @@ #![allow(clippy::module_name_repetitions)] use std::marker::PhantomData; -use crate::errors::injectable::ResolveError; +use crate::errors::injectable::InjectableError; use crate::interfaces::any_factory::AnyFactory; use crate::interfaces::injectable::Injectable; use crate::ptr::{FactoryPtr, SingletonPtr, TransientPtr}; use crate::DIContainer; +#[derive(strum_macros::Display, Debug)] pub enum Providable { Transient(TransientPtr), @@ -21,7 +22,7 @@ pub trait IProvider &self, di_container: &DIContainer, dependency_history: Vec<&'static str>, - ) -> error_stack::Result; + ) -> Result; } pub struct TransientTypeProvider @@ -51,7 +52,7 @@ where &self, di_container: &DIContainer, dependency_history: Vec<&'static str>, - ) -> error_stack::Result + ) -> Result { Ok(Providable::Transient(InjectableType::resolve( di_container, @@ -85,7 +86,7 @@ where &self, _di_container: &DIContainer, _dependency_history: Vec<&'static str>, - ) -> error_stack::Result + ) -> Result { Ok(Providable::Singleton(self.singleton.clone())) } @@ -113,7 +114,7 @@ impl IProvider for FactoryProvider &self, _di_container: &DIContainer, _dependency_history: Vec<&'static str>, - ) -> error_stack::Result + ) -> Result { Ok(Providable::Factory(self.factory.clone())) } -- cgit v1.2.3-18-g5258