fn open<'a, U: 'a + PSafe + RootObj<Self>> (
        _path: &str,
        _flags: u32,
    ) -> Result<RootCell<'a, U, Self>> where Self: MemPool {
        unimplemented!()
    }
/// Opens a pool and retrieves the root object
///
/// The root type should implement [`RootObj`] trait in order to create a
/// root object on its absence. This function [creates and] returns an
/// immutable reference to the root object. The pool remains open as long as
/// the root object is in the scope. Like other persistent objects, the root
/// object is immutable and it is modifiable via interior mutability.
/// 
/// # Flags
///   * O_C:    create a memory pool file if not exists
///   * O_F:    format the memory pool file
///   * O_CNE:  create a memory pool file if not exists
///   * O_CF:   create and format a new memory pool file
///   * O_CFNE: create and format a memory pool file only if not exists
/// 
/// See [`open_flags`](./open_flags/index.html) for more options.
///
/// # Examples
///
/// ```
/// use corundum::default::*;
///
/// let root = Allocator::open::<i32>("foo.pool", O_CF).unwrap();
///
/// assert_eq!(*root, i32::default());
/// ```
///
/// ## Single-thread Shared Root Object
///
/// [`Prc`]`<`[`PCell`]`<T>>` can be used in order to have a mutable shared
/// root object, as follows.
///
/// ```
/// use corundum::default::*;
///
/// type Root = Prc<PCell<i32>>;
///
/// let root = Allocator::open::<Root>("foo.pool", O_CF).unwrap();
///
/// let data = root.get();
///
/// if data == i32::default() {
///     println!("Initializing data");
///     // This block runs only once to initialize the root object
///     transaction(|j| {
///         root.set(10, j);
///     }).unwrap();
/// }
///
/// assert_eq!(root.get(), 10);
/// ```
///
/// ## Thread-safe Root Object
///
/// If you need a thread-safe root object, you may want to wrap the root object
/// in [`Parc`]`<`[`PMutex`]`<T>>`, as shown in the example below:
///
/// ```
/// use corundum::default::*;
/// use std::thread;
///
/// type Root = Parc<PMutex<i32>>;
///
/// let root = Allocator::open::<Root>("foo.pool", O_CF).unwrap();
///
/// let mut threads = vec!();
///
/// for _ in 0..10 {
///     let root = Parc::demote(&root);
///     threads.push(thread::spawn(move || {
///         transaction(|j| {
///             if let Some(root) = root.promote(j) {
///                 let mut root = root.lock(j);
///                 *root += 10;
///             }
///         }).unwrap();
///     }));
/// }
///
/// for thread in threads {
///     thread.join().unwrap();
/// }
///
/// transaction(|j| {
///     let data = root.lock(j);
///     assert_eq!(*data % 100, 0);
/// }).unwrap();
/// ```
///
/// # Errors
///
/// * A volatile memory pool (e.g. `Heap`) doesn't have a root object.
/// * The pool should be open before accessing the root object.
///
/// [`RootObj`]: ../stm/trait.RootObj.html
/// [`Prc`]: ../prc/struct.Prc.html
/// [`Parc`]: ../sync/parc/struct.Parc.html
/// [`PCell`]: ./default/type.PCell.html
/// [`PRefCell`]: ./default/type.PRefCell.html
/// [`PMutex`]: ./default/type.PMutex.html
Opens a pool and retrieves the root object
The root type should implement [`RootObj`] trait in order to create a
root object on its absence. This function [creates and] returns an
immutable reference to the root object. The pool remains open as long as
the root object is in the scope. Like other persistent objects, the root
object is immutable and it is modifiable via interior mutability.
Opens a pool and retrieves the root object The root type should implement [ ` RootObj ` ] trait in order to create a root object on its absence . This function [ creates and ] returns an immutable reference to the root object . The pool remains open as long as the root object is in the scope . Like other persistent objects the root object is immutable and it is modifiable via interior mutability .
fn open<'a, U: 'a + PSafe + RootObj<Self>> (
        _path: &str,
        _flags: u32,
    ) -> Result<RootCell<'a, U, Self>> where Self: MemPool {
        unimplemented!()
    }
fn open < ' a , U : ' a + PSafe + RootObj < Self > > ( _path : & str , _flags : u32 , ) -> Result < RootCell < ' a , U , Self > > where Self : MemPool { unimplemented ! ( ) }
Opens a pool and retrieves the root object
The root type should implement [`RootObj`] trait in order to create a
root object on its absence.
Opens a pool and retrieves the root object The root type should implement [ ` RootObj ` ] trait in order to create a root object on its absence .
_path
&str
_flags
u32
flags
create a memory pool file if not exists
O_F:    format the memory pool file
O_CNE:  create a memory pool file if not exists
O_CF:   create and format a new memory pool file
O_CFNE: create and format a memory pool file only if not exists

See [`open_flags`](./open_flags/index.html) for more options.
create a memory pool file if not exists O_F : format the memory pool file O_CNE : create a memory pool file if not exists O_CF : create and format a new memory pool file O_CFNE : create and format a memory pool file only if not exists See [ ` open_flags ` ] ( . / open_flags / index . html ) for more options .
examples
```
use corundum::default::*.

let root = Allocator::open::("foo.pool", O_CF).unwrap().


` ` ` use corundum :: default :: * . let root = Allocator :: open :: ( " foo . pool " O_CF ) . unwrap () .
single-thread shared root object
[`Prc`]`<`[`PCell`]`>` can be used in order to have a mutable shared
root object, as follows.

```
use corundum::default::*.

type Root = Prc>.

let root = Allocator::open::("foo.pool", O_CF).unwrap().

let data = root.get().

if data == i32::default() {
println!("Initializing data");
This block runs only once to initialize the root object
transaction(|j| {
root.set(10, j);
}).unwrap();
}


[ ` Prc ` ] ` < ` [ ` PCell ` ] ` > ` can be used in order to have a mutable shared root object as follows . ` ` ` use corundum :: default :: * . type Root = Prc > . let root = Allocator :: open :: ( " foo . pool " O_CF ) . unwrap () . let data = root . get () . if data == i32 :: default () { println! ( " Initializing data " ) ; This block runs only once to initialize the root object transaction ( |j| { root . set ( 10 j ) ; } ) . unwrap () ; }
thread-safe root object
If you need a thread-safe root object, you may want to wrap the root object
in [`Parc`]`<`[`PMutex`]`>`, as shown in the example below.

```
use corundum::default::*;
use std::thread.

type Root = Parc>.

let root = Allocator::open::("foo.pool", O_CF).unwrap().

let mut threads = vec!().

for _ in 0..10 {
let root = Parc::demote(&root);
threads.push(thread::spawn(move || {
transaction(|j| {
if let Some(root) = root.promote(j) {
let mut root = root.lock(j);
root += 10;
}
}).unwrap();
}));
}

for thread in threads {
thread.join().unwrap();
}


If you need a thread - safe root object you may want to wrap the root object in [ ` Parc ` ] ` < ` [ ` PMutex ` ] ` > ` as shown in the example below . ` ` ` use corundum :: default :: * ; use std :: thread . type Root = Parc > . let root = Allocator :: open :: ( " foo . pool " O_CF ) . unwrap () . let mut threads = vec! () . for _ in 0 .. 10 { let root = Parc :: demote ( &root ) ; threads . push ( thread :: spawn ( move || { transaction ( |j| { if let Some ( root ) = root . promote ( j ) { let mut root = root . lock ( j ) ; root + = 10 ; } } ) . unwrap () ; } )) ; } for thread in threads { thread . join () . unwrap () ; }
errors
A volatile memory pool  doesn't have a root object.
The pool should be open before accessing the root object.

[`RootObj`]: ../stm/trait.RootObj.html
[`Prc`]: ../prc/struct.Prc.html
[`Parc`]: ../sync/parc/struct.Parc.html
[`PCell`]: ./default/type.PCell.html
[`PRefCell`]: ./default/type.PRefCell.html
[`PMutex`]: ./default/type.PMutex.html
A volatile memory pool doesn ' t have a root object . The pool should be open before accessing the root object . [ ` RootObj ` ] : .. / stm / trait . RootObj . html [ ` Prc ` ] : .. / prc / struct . Prc . html [ ` Parc ` ] : .. / sync / parc / struct . Parc . html [ ` PCell ` ] : . / default / type . PCell . html [ ` PRefCell ` ] : . / default / type . PRefCell . html [ ` PMutex ` ] : . / default / type . PMutex . html