yewtil icon indicating copy to clipboard operation
yewtil copied to clipboard

Add a then_with shim

Open hgzimmerman opened this issue 6 years ago • 1 comments

There is currently a nightly feature for then and then_with functions on bools 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 avatar Dec 02 '19 13:12 hgzimmerman

The naming has been renamed from then/then_with to then_some/then.

hgzimmerman avatar Dec 22 '19 04:12 hgzimmerman