aboutsummaryrefslogtreecommitdiff
path: root/src/ptr.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2023-08-04 22:03:30 +0200
committerHampusM <hampus@hampusmat.com>2023-08-04 22:03:30 +0200
commitb4718494e3a1759286caca1dd34c01db6c2f1214 (patch)
tree736bde3a1647d7c26c7cc27ce3caf4de2fa665d8 /src/ptr.rs
parentb4ddc1e626fbd11d784b442d246ddc5f54c35b51 (diff)
refactor!: remove SomeThreadsafePtr & move variants to SomePtr
BREAKING CHANGE: SomeThreadsafePtr has been removed and it's variants have been moved to SomePtr
Diffstat (limited to 'src/ptr.rs')
-rw-r--r--src/ptr.rs37
1 files changed, 10 insertions, 27 deletions
diff --git a/src/ptr.rs b/src/ptr.rs
index bcaa566..1facc52 100644
--- a/src/ptr.rs
+++ b/src/ptr.rs
@@ -70,6 +70,14 @@ where
#[cfg(feature = "factory")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "factory")))]
Factory(FactoryPtr<Interface>),
+
+ /// A smart pointer to a interface in the singleton scope.
+ ThreadsafeSingleton(ThreadsafeSingletonPtr<Interface>),
+
+ /// A smart pointer to a factory.
+ #[cfg(feature = "factory")]
+ #[cfg_attr(doc_cfg, doc(cfg(feature = "factory")))]
+ ThreadsafeFactory(ThreadsafeFactoryPtr<Interface>),
}
impl<Interface> SomePtr<Interface>
@@ -87,36 +95,11 @@ where
cfg(feature = "factory"),
cfg_attr(doc_cfg, doc(cfg(feature = "factory")))
);
-}
-
-/// Some threadsafe smart pointer.
-#[derive(strum_macros::IntoStaticStr)]
-pub enum SomeThreadsafePtr<Interface>
-where
- Interface: 'static + ?Sized,
-{
- /// A smart pointer to a interface in the transient scope.
- Transient(TransientPtr<Interface>),
- /// A smart pointer to a interface in the singleton scope.
- ThreadsafeSingleton(ThreadsafeSingletonPtr<Interface>),
-
- /// A smart pointer to a factory.
- #[cfg(feature = "factory")]
- #[cfg_attr(doc_cfg, doc(cfg(feature = "factory")))]
- ThreadsafeFactory(ThreadsafeFactoryPtr<Interface>),
-}
-
-impl<Interface> SomeThreadsafePtr<Interface>
-where
- Interface: 'static + ?Sized,
-{
- create_as_variant_fn!(SomeThreadsafePtr, Transient, SomePtrError);
-
- create_as_variant_fn!(SomeThreadsafePtr, ThreadsafeSingleton, SomePtrError);
+ create_as_variant_fn!(SomePtr, ThreadsafeSingleton, SomePtrError);
create_as_variant_fn!(
- SomeThreadsafePtr,
+ SomePtr,
ThreadsafeFactory,
SomePtrError,
cfg(feature = "factory"),