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

Provide with_cloneable to simplify passing shared services to routes #1109

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

andyHa
Copy link

@andyHa andyHa commented Dec 16, 2024

Passing shared services to routes is a very common task. Most of the time these implement Clone
as they're most probably wrapped as Arc anyway. Using with_cloneable is a bit shorter and
more concise than crate::any().map(move || value.clone()).

with_cloneable is essentially a shortcut for:

crate::any().map(move || value.clone())
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