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

Reduce usage of async_trait #5438

Merged
merged 3 commits into from
Feb 19, 2025
Merged

Reduce usage of async_trait #5438

merged 3 commits into from
Feb 19, 2025

Conversation

Nutomic
Copy link
Member

@Nutomic Nutomic commented Feb 18, 2025

There is a lot of unnecessary usage of async_trait which can be replaced with standard Rust functionality. This is preferable as less macro usage means faster compilation, and it uses static dispatch (meaning it chooses at compile time which code to execute, unlike async_trait macro which decides at runtime). However the trait definition is a little more verbose as it cannot use async fn but use fn with -> impl Future.

Copy link
Member

@dessalines dessalines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still see a good amount of these in crates/apub/, and you might as well remove the top level workspace dep in Cargo.toml

@Nutomic
Copy link
Member Author

Nutomic commented Feb 19, 2025

Moved the dependency. The remaining usage of async_trait cannot be removed because it uses dynamic dispatch, which is not supported by the standard library yet.

@dessalines dessalines merged commit a65d403 into main Feb 19, 2025
2 checks passed
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.

2 participants