aboutsummaryrefslogtreecommitdiff
path: root/src/private/factory.rs
blob: 8b8354d7f2dea811b1ea28f07fa0b7ae5de7292b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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,
{
}