Trait hooks_core::HookLifetime
source · pub trait HookLifetime<'hook, Args, ImplicitBounds: HookLifetimeBounds<'hook, Self> = &'hook <Self as HookBounds>::Bounds>: HookBounds {
type Value;
}
Expand description
This is a helper trait to define
lifetime generic associated types (lifetime-GAT)
for Hook
.
This trait follows the better GAT pattern so that lifetime-GAT can be used in earlier rust versions.
This pattern also enables implicit bounds.
Comparing to the common better GAT pattern
which uses &'a Self
as the implicit bound,
this trait uses HookBounds
trait to allow
custom implicit bounds.
With just &'a Self
, returning impl for<'hook> HookLifetime<'hook, Value = ...>
would emit “return type cannot contain a projection or Self…” error.
This might be a compiler bug.