Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to negate an Option<bool>?

Tags:

rust

I'm facing a provided function that takes an Into<Option<bool>> as a parameter but I want to pass it the opposite value of my current bool.

like image 601
Geob-o-matic Avatar asked Oct 02 '17 19:10

Geob-o-matic


1 Answers

Have you tried opt.map(|b| !b)?

like image 175
Lily Ballard Avatar answered Oct 17 '22 12:10

Lily Ballard