Skip to content

Conversation

@luckyuro
Copy link

@luckyuro luckyuro commented Dec 1, 2025

I'd like to use Box for the twurst_build generated Service.
It will require to use the #[async_trait] for serivce from async_trait.

twurst_build::TwirpBuilder::new()
        .with_server()
        .with_client()
        .with_custom_serivce_attribute("#[::async_trait::async_trait]")
        .compile_protos(&[...], &[...])

the generated code will suppose to be

#[::async_trait::async_trait]
pub trait TwirpService {
...
}

I'm not sure whether this would be a common case, and could merge to main branch.
So I'd just put the PR and maybe someone could check.

@vsiles
Copy link
Contributor

vsiles commented Dec 1, 2025

@Tpt We might want to have something like tonic_prost_build.with_type_attribute for twurst ;)

I'm on a trip at the moment, I'll get a look probably next week

@Tpt
Copy link
Collaborator

Tpt commented Dec 2, 2025

In the meantime I think you can impl MyService for Box<dyn MyServiceImplementation> where MyServiceImplementation is your implementation of MyService. It's a bit of boilerplate but it should work.

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

Successfully merging this pull request may close these issues.

3 participants