pub fn access<F, R>(&self, mut f: F) -> Option<R>
    where
        F: FnMut(&T) -> R,
    {
        if let Ok(data) = self.data.read() {
            Some(f(&data))
        } else {
            None
        }
    }
/// Access the inner data of the binding inside of the provided closure
///
/// This will return [`None`] and will **not** run the supplied closure if a lock to the inner
/// data cannot be obtained due to lock [poisoning][RwLock#poisoning].
///
/// # Example
///
/// ```
/// # use raui_core::prelude::*;
/// let binding = DataBinding::new(false);
///
/// let x = binding.access(|data| {
///     // Return the opposite of what's in our data
///     !data
/// });
///
/// assert_eq!(x, Some(true));
/// ```
Access the inner data of the binding inside of the provided closure
This will return [`None`] and will **not** run the supplied closure if a lock to the inner
data cannot be obtained due to lock [poisoning][RwLock#poisoning].
Access the inner data of the binding inside of the provided closure This will return [ ` None ` ] and will ** not ** run the supplied closure if a lock to the inner data cannot be obtained due to lock [ poisoning ] [ RwLock#poisoning ] .
pub fn access<F, R>(&self, mut f: F) -> Option<R>
    where
        F: FnMut(&T) -> R,
    {
        if let Ok(data) = self.data.read() {
            Some(f(&data))
        } else {
            None
        }
    }
pub fn access < F , R > ( & self , mut f : F ) -> Option < R > where F : FnMut ( & T ) -> R , { if let Ok ( data ) = self . data . read ( ) { Some ( f ( & data ) ) } else { None } }
Access the inner data of the binding inside of the provided closure
This will return [`None`] and will **not** run the supplied closure if a lock to the inner
data cannot be obtained due to lock [poisoning][RwLock#poisoning].
Access the inner data of the binding inside of the provided closure This will return [ ` None ` ] and will ** not ** run the supplied closure if a lock to the inner data cannot be obtained due to lock [ poisoning ] [ RwLock#poisoning ] .
&self
f
F
&self
f
F
example
None
use raui_core::prelude::*;
let binding = DataBinding::new(false).

let x = binding.access(|data| {
Return the opposite of what's in our data
data
}).


let binding = DataBinding :: new ( false ) . let x = binding . access ( |data| { Return the opposite of what ' s in our data data } ) .