Skip to main content

HookValue

Trait HookValue 

Source
pub trait HookValue<'hook, ImplicitBounds: HookValueBounds<'hook, Self> = &'hook Self> {
    type Value;
}
Expand description

A helper trait to define lifetime generic associated types (lifetime-GAT) for Hook.

This trait follows the better GAT pattern. better GAT is a pattern which implements lifetime-GAT without real GAT, and it also solves some problems relating to for<'hook> HookValue<Value<'hook> = ...> that real GAT currently doesn’t solve.

Please don’t impl this trait manually because in the future this will be changed to GAT. Instead, use impl_hook![...];.

Required Associated Types§

Source

type Value

The output type of Hook::use_hook.

Please don’t use this associated type directly. Instead, use Value![] for future compatibility.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<'hook, H: Hook + Unpin + ?Sized> HookValue<'hook> for &mut H

Source§

type Value = <H as HookValue<'hook>>::Value

Source§

impl<'hook, H: Hook + Unpin + ?Sized> HookValue<'hook> for Box<H>

Source§

type Value = <H as HookValue<'hook>>::Value

Source§

impl<'hook, P> HookValue<'hook> for Pin<P>
where P: DerefMut, <P as Deref>::Target: Hook,

Source§

type Value = <<P as Deref>::Target as HookValue<'hook>>::Value

Implementors§

Source§

impl<'hook, InnerHook: Default + HookPollNextUpdate + HookUnmount, U: FnMutOneArg<Pin<&'hook mut InnerHook>>, I: Initialized> HookValue<'hook> for FnHook<InnerHook, U, I>