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

Callbacks: Manual Clone and Debug impl; Visibility fix #1703

Merged
merged 1 commit into from
Sep 13, 2023

Conversation

lpotthast
Copy link
Contributor

Great to see, that this is now part of Leptos :). This PR mainly adds manual Clone and Debug implementations.

The manual Clone impl removes the Clone type bounds on the generic In and Out types. All callback types can be cloned by simply cloning the inner Rc. The generic types are not important here.

The Debug impls are debatable, as they are not strictly needed. But I would say it's good practice to supply users with a Debug impl for ALL custom types a library provides, as this is somewhat expected. (The ability to derive Debug on your types without problems.) If not provided, users would always need to add custom Debug impls for all structs in which they want to store some Callback type and have a Debug impl on that struct.

Also adds a missing pub modifier to construct ViewCallback::new.

@gbj
Copy link
Collaborator

gbj commented Sep 13, 2023

Thanks, I always forget about manual Clone impls and it always bites me. And I agree re: Debug implementations, so thanks for those.

@gbj gbj merged commit dc1ba24 into leptos-rs:main Sep 13, 2023
55 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