| ▲ | thayne 2 days ago | |
If you have a (&mut) reference it would actually be x = !x. Also toggle is a function that can be passed to higher order functions without needing a lambda. For example, if you have a boolean in an option you can do opt.iter_mut().for_each(book::toggle). Or similar if you had a collection of booleans. | ||