A snippet is worth a thousand words.

// Define a simple boolean value as false
let booleana: bool = false;

// No surprises if we access the element
println!("Result pre-scope: {}", *booleana.lock().unwrap());  // -> false

  {
      let mut m = booleana.lock().unwrap();
      *m = true;  // you should dereference to change the content
      println!("Result in-scope: {}", m);  // -> true  // success!
  }

// The new value is retained out of scope
println!("Result post-scope: {}", *booleana.lock().unwrap());  // -> true