pub fn new(t: T) -> Vault<T> {
    let inner = Arc::new(Inner {
      lock: spin::Mutex::new(InnerLock {
        locked: false,
        waiting: Vec::with_capacity(2),
      }),
      data: UnsafeCell::new(t)
    });

    Vault {
      inner: inner
    }
  }
/// Create a new `Vault` containing some data.
///
/// # Example
///
/// ```
/// # use popcorn::vault::*;
/// #
/// // Create a new Vault containing a double
/// let vault: Vault<f64> = Vault::new(34.5);
///
/// // Acquire the lock to the vault
/// let acquired = vault.try_lock().unwrap();
///
/// // Access the value in the vault
/// let value: f64 = *acquired;
/// #
/// # assert_eq!(value, 34.5);
/// ```
Create a new `Vault` containing some data.
Create a new ` Vault ` containing some data .
pub fn new(t: T) -> Vault<T> {
    let inner = Arc::new(Inner {
      lock: spin::Mutex::new(InnerLock {
        locked: false,
        waiting: Vec::with_capacity(2),
      }),
      data: UnsafeCell::new(t)
    });
    Vault {
      inner: inner
    }
  }
pub fn new ( t : T ) -> Vault < T > { let inner = Arc :: new ( Inner { lock : spin :: Mutex :: new ( InnerLock { locked : false , waiting : Vec :: with_capacity ( 2 ) , } ) , data : UnsafeCell :: new ( t ) } ) ; Vault { inner : inner } }
Create a new `Vault` containing some data.
Create a new ` Vault ` containing some data .
t
T
t
T
example
None
use popcorn::vault::*;
Create a new Vault containing a double
let vault: Vault = Vault::new(34.5).

Acquire the lock to the vault
let acquired = vault.try_lock().unwrap().

Access the value in the vault
let value: f64 = *acquired.
Create a new Vault containing a double let vault : Vault = Vault :: new ( 34 . 5 ) . Acquire the lock to the vault let acquired = vault . try_lock () . unwrap () . Access the value in the vault let value : f64 = * acquired .
assert_eq!(value, 34.5);
None