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

entrait 0.7 #31

Merged
merged 2 commits into from
Mar 27, 2024
Merged

entrait 0.7 #31

merged 2 commits into from
Mar 27, 2024

Conversation

audunhalland
Copy link
Owner

@audunhalland audunhalland commented Mar 27, 2024

async rework

There's no need to have the box_futures, use_associated_futures, etc things anymore now that Rust natively supports async fn in traits. Those features also made the library much more complicated.

The only reason to box futures in Rust that I can think of is in the case of dynamic dispatch, and the go-to solution for that is still #[async_trait].
Entrait 0.7 will instead have interoperability with the async_trait macro, and users will explicitly use that instead of passing a "magic keyword" into the entrait macro.

async Send-ness

How to approach Send bounds on Future is a recurring debate in the development of the Rust language. async_trait made a design decision to make all futures Send by default, with an opt-out available via #[async_trait(?Send)]. I think entrait will take a similar approach, i.e. #[entrait(SomeTrait, ?Send)] will make any async fn in the generated trait opt out of the Send bound. I don't think this should be made automatic via features, because it changes the behaviour instead of being additive.

unimock upgrade

This entrait version will depend on unimock 0.6, which contains important fixes related to mutable references in function arguments.

@audunhalland audunhalland merged commit 05517c4 into main Mar 27, 2024
2 checks passed
@audunhalland audunhalland deleted the next branch March 27, 2024 18:29
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.

1 participant