Skip to content

Don't require Arc in router #85

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

Merged
merged 4 commits into from
Aug 20, 2024
Merged

Don't require Arc in router #85

merged 4 commits into from
Aug 20, 2024

Conversation

tclem
Copy link
Member

@tclem tclem commented Aug 20, 2024

Changes the signature of router to generalize to requiring Clone instead of forcing wrapping in Arc. This enables services to implement their own inner ownership logic.

This is a breaking change.

@tclem tclem requested a review from a team as a code owner August 20, 2024 18:29
Copy link
Contributor

@jorendorff jorendorff left a comment

Choose a reason for hiding this comment

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

Great, :shipit:

@tclem tclem added this pull request to the merge queue Aug 20, 2024
Merged via the queue into main with commit 7245d45 Aug 20, 2024
2 checks passed
@tclem tclem deleted the tclem/just-require-clone branch August 20, 2024 19:05
@@ -38,12 +38,29 @@ impl prost_build::ServiceGenerator for ServiceGenerator {
}
writeln!(buf, "}}").unwrap();

writeln!(buf, "#[twirp::async_trait::async_trait]").unwrap();
writeln!(buf, "impl<T> {service_name} for std::sync::Arc<T>").unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that you could actually impl for AsRef<T> rather than Arc<T> and cover more cases. Arc has a blanket impl for AsRef I believe.

@CleanCut
Copy link
Contributor

This PR was included in v0.8.0, released today.

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.

4 participants