Use And Change Mutex Value In A Rust Struct Object

Note

I'm still new to rust. There might be different/better ways to do this, but this is working for me for a cache

use std::sync::Mutex;

#[derive(Debug)]
pub struct Widget {
    pub holder: Mutex<u8>,
}

impl Widget {
    pub fn new(holder: Mutex<u8>) -> Widget {
        Widget { holder }
    }
    pub fn move_it(&self) {
        let mut pinger = self.holder.lock().unwrap();
        *pinger = 7;
    }
}

fn main() {
    let holder = Mutex::new(5);
    let w = Widget { holder };
    println!("m = {:?}", w.holder);
    w.move_it();
    println!("m = {:?}", w.holder);
}
TODO: Show Results Output
~ fin ~