Closures capture disjoint fields

Changes in new versions / Rust 2021

struct Config {
    name: String,
    retries: u32,
}

let mut c = Config { name: String::from("prod"), retries: 3 };

// *** before: ***
let show = || println!("{}", c.name);   // the closure captured ALL of c
c.retries += 1;                         // an error: c is held by the closure
show();

// *** in version Rust 2021: ***
let show = || println!("{}", c.name);   // exactly the field c.name is captured
c.retries += 1;                         // the other fields stay free
show();