ferrunix_core/
object_builder.rs

1//! Builder singleton or transient objects, with our without dependencies.
2
3#[cfg(not(feature = "tokio"))]
4#[path = "./object_builder_sync.rs"]
5pub(crate) mod inner;
6
7#[cfg(feature = "tokio")]
8#[path = "./object_builder_async.rs"]
9pub(crate) mod inner;
10
11pub(crate) use inner::*;
12
13/// All possible "objects" that can be held by the registry.
14#[cfg(not(feature = "tokio"))]
15pub(crate) enum Object {
16    /// An object with transient lifetime.
17    Transient(crate::types::BoxedTransientBuilder),
18    /// An object with singleton lifetime.
19    Singleton(crate::types::BoxedSingletonGetter),
20}
21
22/// All possible "objects" that can be held by the registry.
23#[cfg(feature = "tokio")]
24pub(crate) enum Object {
25    /// An object with transient lifetime.
26    AsyncTransient(Box<dyn AsyncTransientBuilder + Send + Sync>),
27    /// An object with singleton lifetime.
28    AsyncSingleton(Box<dyn AsyncSingleton + Send + Sync>),
29}