/// Runs an initialization function.
///
/// `f` will be run only if this is the first time this method has been called
/// on this ROnce.
///
/// Once this function returns it is guaranteed that some closure passed
/// to this method has run to completion.
///
/// # Panics
///
/// Panics in the closure will cause this ROnce to become poisoned,
/// and any future calls to this method will panic.
///
/// # Example
///
/// ```
/// use abi_stable::external_types::ROnce;
///
/// let once = ROnce::new();
/// let mut counter = 0usize;
///
/// once.call_once(|| counter += 1);
/// once.call_once(|| counter += 1);
/// once.call_once(|| counter += 1);
/// once.call_once(|| counter += 1);
///
/// assert_eq!(counter, 1);
///
/// ```
Runs an initialization function.
`f` will be run only if this is the first time this method has been called
on this ROnce.

Once this function returns it is guaranteed that some closure passed
to this method has run to completion.
Runs an initialization function . ` f ` will be run only if this is the first time this method has been called on this ROnce . Once this function returns it is guaranteed that some closure passed to this method has run to completion .
pub fn call_once<F>(&self, f: F)
    where
        F: FnOnce(),
    {
        let mut closure = Closure::without_state(f);
        let func = closure.func;
        let res = unsafe {
            self.vtable().call_once()(
                &self.opaque_once,
                RMut::new(&mut closure).transmute::<ErasedClosure>(),
                func,
            )
        };
        if let Err(e) = closure.panic {
            panic::resume_unwind(e);
        }
        if let RErr(()) = res {
            panic!("This ROnce instantce is poisoned.");
        }
    }
pub fn call_once < F > ( & self , f : F ) where F : FnOnce ( ) , { let mut closure = Closure :: without_state ( f ) ; let func = closure . func ; let res = unsafe { self . vtable ( ) . call_once ( ) ( & self . opaque_once , RMut :: new ( & mut closure ) . transmute :: < ErasedClosure > ( ) , func , ) } ; if let Err ( e ) = closure . panic { panic :: resume_unwind ( e ) ; } if let RErr ( ( ) ) = res { panic ! ( " " ) ; } }
Runs an initialization function.
Runs an initialization function .
&self
f
F
panics
Panics in the closure will cause this ROnce to become poisoned,
and any future calls to this method will panic.
Panics in the closure will cause this ROnce to become poisoned and any future calls to this method will panic .
example
```
use abi_stable::external_types::ROnce.

let once = ROnce::new();
let mut counter = 0usize.



assert_eq!(counter, 1).


` ` ` use abi_stable :: external_types :: ROnce . let once = ROnce :: new () ; let mut counter = 0usize . assert_eq! ( counter 1 ) .