diff options
author | HampusM <hampus@hampusmat.com> | 2022-11-19 15:45:12 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-11-19 15:45:12 +0100 |
commit | 9f27a925bd323e8e0864bedeb33a3c6953517ea1 (patch) | |
tree | ea5d8faaed82c58fa037fa377173bb365e1cd697 /src/private/factory.rs | |
parent | d99cbf9fa95856cbc14a3217e1cd3f13aeb2e0b3 (diff) |
refactor: reorganize non-public API items
Diffstat (limited to 'src/private/factory.rs')
-rw-r--r-- | src/private/factory.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/private/factory.rs b/src/private/factory.rs new file mode 100644 index 0000000..8b8354d --- /dev/null +++ b/src/private/factory.rs @@ -0,0 +1,23 @@ +use std::marker::Tuple; + +use crate::private::cast::CastFrom; +use crate::ptr::TransientPtr; + +/// Interface for a factory. +pub trait IFactory<Args, ReturnInterface>: + Fn<Args, Output = TransientPtr<ReturnInterface>> + CastFrom +where + Args: Tuple, + ReturnInterface: 'static + ?Sized, +{ +} + +/// Interface for a threadsafe factory. +#[cfg(feature = "async")] +pub trait IThreadsafeFactory<Args, ReturnInterface>: + Fn<Args, Output = TransientPtr<ReturnInterface>> + crate::private::cast::CastFromSync +where + Args: Tuple, + ReturnInterface: 'static + ?Sized, +{ +} |