dynamic_provider/
type_fn.rs1use core::convert::Infallible;
2
3use crate::{
4 lt::{HktWrapper, LifetimeHkt},
5 Lt,
6};
7
8impl<H: ?Sized> TypeFn for HktWrapper<H>
9where
10 Self: for<'y> LifetimeHkt<Actual<'y>: TypeFn>,
11{
12 type Output<L: Lt> = <L::NextTypeFn<Self> as TypeFn>::Output<L::NextExtending>;
13}
14
15pub trait TypeFn: Sized {
24 type Output<L: Lt>: ?Sized;
25}
26
27impl TypeFn for () {
28 type Output<L: Lt> = Self;
29}
30
31impl TypeFn for Infallible {
32 type Output<L: Lt> = Self;
33}
34
35#[macro_export]
43macro_rules! TypeFn {
44 (for <> $T:ty) => { $crate::Value<$T> };
45 (for <$lt0:lifetime $(,$lt:lifetime)* $(,)?> $T:ty) => {
46 $crate::LifetimeHkt![for<$lt0> $crate::TypeFn![for <$($lt),*> $T]]
47 };
48 ($T:ty) => { $crate::Value<$T> };
49}