Add a then_with shim
hgzimmerman opened this issue · 1 comments
hgzimmerman commented
There is currently a nightly feature for then
and then_with
functions on bool
s that allow them to be turned into Options
using a provided value or closure.
This in conjunction with unwrap_or_default
can be used to easily write "show this html or nothing" sections.
A stable shim trait for this could be added to this crate, have it live in experimental, and then remove it once the actual feature stabilizes.
https://doc.rust-lang.org/std/primitive.bool.html#method.then_with
hgzimmerman commented
The naming has been renamed from then
/then_with
to then_some
/then
.