#[kind]Expand description
Adds a Kind supertrait bound to a trait definition.
This attribute macro parses a Kind signature and adds the corresponding
Kind_ trait as a supertrait bound, avoiding the need to reference
hash-based trait names directly.
§Syntax
ⓘ
#[kind(type AssocName<Params>: Bounds;)]
pub trait MyTrait {
// ...
}§Examples
ⓘ
// Invocation
#[kind(type Of<'a, A: 'a>: 'a;)]
pub trait Functor {
fn map<'a, A: 'a, B: 'a>(
f: impl Fn(A) -> B + 'a,
fa: Apply!(<Self as Kind!(type Of<'a, T: 'a>: 'a;)>::Of<'a, A>),
) -> Apply!(<Self as Kind!(type Of<'a, T: 'a>: 'a;)>::Of<'a, B>);
}
// Expanded code
pub trait Functor: Kind_cdc7cd43dac7585f {
// body unchanged
}ⓘ
// Works with existing supertraits
#[kind(type Of<'a, A: 'a>: 'a;)]
pub trait Monad: Applicative {
// Kind_ bound is appended: Monad: Applicative + Kind_...
}