diff options
author | HampusM <hampus@hampusmat.com> | 2023-08-05 23:14:06 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2023-08-05 23:14:06 +0200 |
commit | 89c238f9c82ade2d7656e2bee76838a391609a88 (patch) | |
tree | 8771a893a9c83b06715c3af0fa2da3cd206b0716 /src/dependency_history.rs | |
parent | ddc666c55eec968f9a99408f3e3ad0f92d932179 (diff) |
refactor!: remove IDependencyHistory
BREAKING CHANGE: IDependencyHistory has been removed as part of an effort to simplify the API. This affects IDIContainer, DIContainer, IAsyncDIContainer, AsyncDIContainer, Injectable, AsyncInjectable, BindingBuilder, AsyncBindingBuilder, BindingScopeConfigurator, BindingWhenConfigurator, AsyncBindingScopeConfigurator, AsyncBindingWhenConfigurator and DependencyHistory
Diffstat (limited to 'src/dependency_history.rs')
-rw-r--r-- | src/dependency_history.rs | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/src/dependency_history.rs b/src/dependency_history.rs index 4e36a7b..cd4e77d 100644 --- a/src/dependency_history.rs +++ b/src/dependency_history.rs @@ -7,18 +7,6 @@ use std::fmt::{Debug, Display}; const BOLD_MODE: &str = "\x1b[1m"; const RESET_BOLD_MODE: &str = "\x1b[22m"; -/// Dependency history interface. -/// -/// **This trait is sealed and cannot be implemented for types outside this crate.** -pub trait IDependencyHistory: private::Sealed -{ - #[doc(hidden)] - fn push<Dependency: 'static + ?Sized>(&mut self); - - #[doc(hidden)] - fn contains<Dependency: 'static + ?Sized>(&self) -> bool; -} - /// Dependency history. #[derive(Clone, Debug)] pub struct DependencyHistory @@ -35,16 +23,18 @@ impl DependencyHistory } } -impl IDependencyHistory for DependencyHistory +#[cfg_attr(test, mockall::automock)] +impl DependencyHistory { #[doc(hidden)] - fn push<Dependency: 'static + ?Sized>(&mut self) + pub fn push<Dependency: 'static + ?Sized>(&mut self) { self.inner.push(type_name::<Dependency>()); } #[doc(hidden)] - fn contains<Dependency: 'static + ?Sized>(&self) -> bool + #[allow(clippy::must_use_candidate)] + pub fn contains<Dependency: 'static + ?Sized>(&self) -> bool { self.inner.contains(&type_name::<Dependency>()) } |