Use method instead of trait for .call
syntax
#1921
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR completely removes the
Callable
trait fromleptos_reactive
, since it was used only incallback.rs
and it didn't add anything compared to a method call.It is technically a breaking change, but only for people that used the
Callback
trait explicitely. Given thatcallbacks
does not even appear in the book, this will likely affect nobody.The main motivation for this change is to suppress a compiler warning.
If you were on nightly and used the
.call
syntax, the compiler would give you a warning saying "you may need to disambiguate .call in the future because a trait method will be called like that". It can be very annoying when someone writes a library for leptos using stable, and someone use it on nightly.Since method calls take precedence, you will not get any warning with this new version.
I plan to create a chapter about callbacks and generic function props, but the content will depend on whether this PR is accepted