Hacker News new | ask | show | jobs
by saghm 20 days ago
If you're dealing with something like an `Option<bool>` or `Vec<bool>`, it might be nice to avoid needing to do a more verbose dereference and assign:

    let mut vec = vec![false, false, false, false];
    vec[2].toggle();
    *vec[2] = !vec[2];
"Good enough" is subjective, but I personally prefer the new way