And a blanket impl, so the implementer only has to implement one trait:
impl<T> IntFactory for T
where
T: SendIntFactory,
{
async fn make(&self, x: u32, y: &str) -> i32 {
<Self as SendIntFactory>::make(self, x, y).await
}
fn stream(&self) -> impl Iterator<Item = i32> {
<Self as SendIntFactory>::stream(self)
}
fn call(&self) -> u32 {
<Self as SendIntFactory>::call(self)
}
}
After brainstorming a handful of options I settled on variant as the most self-explanatory name for what this macro does. It does unfortunately conflict with enum variants, but I don't think that will actually be confusing in context.
My hope is that this will be forward-compatible with both RTN and implementable trait aliases, as described here.
This takes an input like this:
And creates an additional trait with the specified bounds:
And a blanket impl, so the implementer only has to implement one trait:
After brainstorming a handful of options I settled on
variant
as the most self-explanatory name for what this macro does. It does unfortunately conflict with enum variants, but I don't think that will actually be confusing in context.My hope is that this will be forward-compatible with both RTN and implementable trait aliases, as described here.