yew/packages
Jens Reimann beb0157c48
Allow skipping a callback when reforming (#2864)
* Allow skipping a callback when reforming

This adds a method to the callback, similar to Rust's filter_map, which
allows to reform a callback, but also suppress the emit in case
the reform function returns `None`.

* Update packages/yew/src/callback.rs

Co-authored-by: WorldSEnder <WorldSEnder@users.noreply.github.com>

* Implement filter_reform for all Callback output types

As suggested in the PR, this implements filter_reform for all output
types of callbacks by mapping to `Option<OUT>`.

* Fix clippy error

Although I believe that the code is more readable/understandable with
an explicit map, I am not sure adding a clippy exception just for that
is justified. So I applied the clippy suggestion.

Co-authored-by: WorldSEnder <WorldSEnder@users.noreply.github.com>
2022-09-15 01:14:58 +02:00
..
2022-06-24 20:17:58 +02:00
2022-08-12 22:16:05 +09:00