Utilities for working with impl traits in Rust.
trait_variant
trait_variant
generates a specialized version of a base trait that uses async fn
and/or -> impl Trait
. For example, if you want a Send
able version of your trait, you'd write:
Which creates a new IntFactory: Send
trait and additionally bounds IntFactory::make(): Send
and IntFactory::stream(): Send
. Ordinary methods are not affected.
Implementers of the trait can choose to implement the variant instead of the original trait. The macro creates a blanket impl which ensures that any type which implements the variant also implements the original trait.
License and usage notes
Licensed under either of Apache License, Version 2.0 or MIT license at your option.