impl_kind!() { /* proc-macro */ }Expand description
Implements a Kind trait for a brand.
This macro simplifies the implementation of a generated Kind trait for a specific
brand type. It infers the correct Kind trait to implement based on the signature
of the associated type Of.
§Syntax
ⓘ
impl_kind! {
impl<GENERICS> for BrandType {
type Of<PARAMS> = ConcreteType;
}
}Or with where clause:
ⓘ
impl_kind! {
impl<E> for ResultBrand<E> where E: Debug {
type Of<A> = Result<A, E>;
}
}§Examples
ⓘ
// Simple implementation
impl_kind! {
for OptionBrand {
type Of<A> = Option<A>;
}
}
// Implementation with generics
impl_kind! {
impl<E> for ResultBrand<E> {
type Of<A> = Result<A, E>;
}
}
// Implementation with where clause and multiple types
impl_kind! {
impl<E> for MyBrand<E> where E: Clone {
type Of<A> = MyType<A, E>;
type SendOf<A> = MySendType<A, E>;
}
}