Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

async_trait incompatible with builder-pattern #28

Open
clotodex opened this issue May 15, 2023 · 0 comments
Open

async_trait incompatible with builder-pattern #28

clotodex opened this issue May 15, 2023 · 0 comments

Comments

@clotodex
Copy link

I cannot get async_trait and builder-pattern to play nice together.

My test (assume MyAsyncTrait exists):

#[derive(Builder)]
pub struct MyStruct {
    a: SomeStructA,
    b_provider: Box<dyn MyAsyncTrait>,
}

It complains that MyAsyncTrait cannot be made into an object. My guess is that either the double-code generation breaks something OR that builder-pattern would need to place the #[async_trait] in its generated code too.

This is currently blocking me from using the builder pattern.


If this is too hard to implement, Rust aims to support a first version of stable async traits (not via library) from 1.74, which should land in July. Then this might be resolved. What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant