#[derive(TypeAssoc)]
{
// Attributes available to this derive:
#[type_assoc]
}
Expand description
Implements traits that only have associated types.
ยงExample
trait Foo {
type Item;
}
#[derive(mkutils_macros::TypeAssoc)]
#[type_assoc(impl_trait = Foo, Item = Vec<u8>)]
struct MyStruct;
// adds
// ```rust
// impl Foo for MyStruct {
// type Item = Vec<u8>;
// }
// ```
// as can be seen in
fn consume_foo<T: Foo>(value: T) {}
consume_foo(MyStruct);