pub fn initialize(arc: &Option<Parc<T, A>>, value: T) -> crate::result::Result<()> {
        assert!(
            !Journal::<A>::is_running(),
            "Parc::initialize() cannot be used inside a transaction"
        );
        match arc {
            Some(_) => Err("already initialized".to_string()),
            None => if A::valid(arc) {
                unsafe {
                    let new = A::atomic_new(
                        ParcInner::<T, A> {
                            counter: Counter {
                                strong: 1,
                                weak: 1,
                                lock: VCell::new(0),
                            },
        
                            #[cfg(not(feature = "no_volatile_pointers"))]
                            vlist: VCell::new(VWeakList::default()),
        
                            marker: PhantomData,
                            value,
                        });
                    let pnew = Some(Parc::<T, A>::from_inner(Ptr::from_off_unchecked(new.1)));
                    let src = crate::utils::as_slice64(&pnew);
                    let mut base = A::off_unchecked(arc);
                    for i in src {
                        A::log64(base, *i, new.3);
                        base += 8;
                    }
                    A::perform(new.3);
                }
                Ok(())
            } else {
                Err("The object is not in the PM".to_string())
            }
        }
    }
/// Initializes boxed data with `value` in-place if it is `None`
///
/// This function should not be called from a transaction as it updates
/// data without taking high-level logs. If transaction is unsuccessful,
/// there is no way to recover data.
/// However, it is safe to use it outside a transaction because it uses
/// low-level logs to provide safety for a single update without drop.
/// A dynamic check at the beginning makes sure of that.
///
/// # Examples
///
/// ```
/// use corundum::default::*;
/// 
/// type P = Allocator;
///
/// let root = P::open::<Option<Parc<i32>>>("foo.pool", O_CF).unwrap();
///
/// Parc::initialize(&*root, 25);
/// 
/// let value = **root.as_ref().unwrap();
/// assert_eq!(value, 25);
/// ```
///
Initializes boxed data with `value` in-place if it is `None`
This function should not be called from a transaction as it updates
data without taking high-level logs. If transaction is unsuccessful,
there is no way to recover data.
However, it is safe to use it outside a transaction because it uses
low-level logs to provide safety for a single update without drop.
A dynamic check at the beginning makes sure of that.
Initializes boxed data with ` value ` in - place if it is ` None ` This function should not be called from a transaction as it updates data without taking high - level logs . If transaction is unsuccessful there is no way to recover data . However it is safe to use it outside a transaction because it uses low - level logs to provide safety for a single update without drop . A dynamic check at the beginning makes sure of that .
pub fn initialize(arc: &Option<Parc<T, A>>, value: T) -> crate::result::Result<()> {
        assert!(
            !Journal::<A>::is_running(),
            "Parc::initialize() cannot be used inside a transaction"
        );
        match arc {
            Some(_) => Err("already initialized".to_string()),
            None => if A::valid(arc) {
                unsafe {
                    let new = A::atomic_new(
                        ParcInner::<T, A> {
                            counter: Counter {
                                strong: 1,
                                weak: 1,
                                lock: VCell::new(0),
                            },
                            #[cfg(not(feature = "no_volatile_pointers"))]
                            vlist: VCell::new(VWeakList::default()),
                            marker: PhantomData,
                            value,
                        });
                    let pnew = Some(Parc::<T, A>::from_inner(Ptr::from_off_unchecked(new.1)));
                    let src = crate::utils::as_slice64(&pnew);
                    let mut base = A::off_unchecked(arc);
                    for i in src {
                        A::log64(base, *i, new.3);
                        base += 8;
                    }
                    A::perform(new.3);
                }
                Ok(())
            } else {
                Err("The object is not in the PM".to_string())
            }
        }
    }
pub fn initialize ( arc : & Option < Parc < T , A > > , value : T ) -> crate :: result :: Result < ( ) > { assert ! ( Journal A is_running ( ) " " ) ; match arc { Some ( _ ) => Err ( " " . to_string ( ) ) , None => if A :: valid ( arc ) { unsafe { let new = A :: atomic_new ( ParcInner :: < T , A > { counter : Counter { strong : 1 , weak : 1 , lock : VCell :: new ( 0 ) , } , # [ cfg ( not ( feature " " ) ) ] vlist : VCell :: new ( VWeakList :: default ( ) ) , marker : PhantomData , value , } ) ; let pnew = Some ( Parc :: < T , A > :: from_inner ( Ptr :: from_off_unchecked ( new . 1 ) ) ) ; let src = crate :: utils :: as_slice64 ( & pnew ) ; let mut base = A :: off_unchecked ( arc ) ; for i in src { A :: log64 ( base , * i , new . 3 ) ; base += 8 ; } A :: perform ( new . 3 ) ; } Ok ( ( ) ) } else { Err ( " " . to_string ( ) ) } } }
Initializes boxed data with `value` in-place if it is `None`
This function should not be called from a transaction as it updates
data without taking high-level logs.
Initializes boxed data with ` value ` in - place if it is ` None ` This function should not be called from a transaction as it updates data without taking high - level logs .
arc
&Option<Parc<T, A>>
value
T
examples
```
use corundum::default::*.

type P = Allocator.






` ` ` use corundum :: default :: * . type P = Allocator .