-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
Not sure if this was considered when designing the crate, but I was hoping to have the following use case as handled by this crate as well
#[trait_variant::make(async_variant = [LocalAsyncSomeTrait, AsyncSomeTrait: Send])]
trait SomeTrait {
#[variant(make_async)]
fn blocking_method(&self) -> Result<Value, Error>;
#[variant(inherit)]
fn method_to_auto_impl(&self);
#[variant(skip)]
fn method_is_skipped(&self);
}The above would expand to
trait LocalAsyncSomeTrait: SomeTrait {
fn blocking_method(&self) -> impl Future<Output = Result<Value, Error>>;
fn method_to_auto_impl(&self) {
<Self as SomeTrait>::method_to_auto_impl(self)
}
}
trait AsyncSomeTrait: LocalAsyncSomeTrait {
fn blocking_method(&self) -> impl Future<Output = Result<Value, Error>> + Send;
fn method_to_auto_impl(&self) {
<Self as SomeTrait>::method_to_auto_impl(self)
}
}This way a single crate can defined multiple traits. This is in no way refined and probably needs some design, but would be great addition in my opinion
Metadata
Metadata
Assignees
Labels
No labels