roopes_core/patterns/abstract_factory/
mod.rs

1//!
2#![cfg_attr(feature = "doc-images",
3  cfg_attr(
4    all(),
5    doc = ::embed_doc_image::embed_image!(
6        "abstract-factory-diagram",
7        "src/patterns/abstract_factory/abstract_factory.svg"
8)))]
9#![cfg_attr(
10    not(feature = "doc-images"),
11    doc = "**Doc images not enabled**. Compile with feature `doc-images` and \
12           Rust version >= 1.54 to enable."
13)]
14//! Provides an abstraction for object creation.
15//!
16//! ![abstract factory diagram][abstract-factory-diagram]
17
18pub mod lambda;
19
20pub use lambda::Lambda;
21
22/// This trait enables the abstraction of the
23/// creation of objects.
24pub trait AbstractFactory<T>
25{
26    /// Executes the creation logic and provides
27    /// the type back to the caller.
28    fn create(&self) -> T;
29}
30
31/// Exposes [`AbstractFactory`] at the library level.
32pub mod prelude
33{
34    pub use super::AbstractFactory;
35}