aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/factory.rs
blob: 81c594b4b1d02bfa206704635d8d91d292fa0180 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#![allow(clippy::module_name_repetitions)]

//! Interface for a factory.
//!
//! ---
//!
//! *This module is only available if Syrette is built with the "factory" feature.*
use crate::libs::intertrait::CastFrom;
use crate::ptr::TransientPtr;

/// Interface for a factory.
///
/// # Examples
/// ```
/// use syrette::interfaces::factory::IFactory;
///
/// type StringFactory = dyn IFactory<(), String>;
/// ```
pub trait IFactory<Args, ReturnInterface>:
    Fn<Args, Output = TransientPtr<ReturnInterface>> + CastFrom
where
    ReturnInterface: 'static + ?Sized,
{
}