pub fn new<P: AsRef<Path>>(path: P, append: bool) -> Result<Self, DatabaseError> {
        let file = if append {
            OpenOptions::new()
                .read(true)
                .create(true)
                .append(true)
                .open(path.as_ref())?
        } else {
            OpenOptions::new()
                .read(true)
                .create(true)
                .write(true)
                .truncate(true)
                .open(path.as_ref())?
        };
        Ok(Self {
            file,
            _phantom: std::marker::PhantomData::default(),
        })
    }
/// Creates a new client. It opens the file if a file with the same name exists or
/// creates a new file if it doesn't exist. Set the `append` parameter to `false` if you want to
/// overwrite all data while calling `write()` or `write_many()`, or `true` if you
/// simply want to append data to the file.
///
/// # Errors
///
/// - Returns `std::io::Error` if it fails to open or create a new file.
Creates a new client. It opens the file if a file with the same name exists or
creates a new file if it doesn't exist.
Creates a new client . It opens the file if a file with the same name exists or creates a new file if it doesn ' t exist .
pub fn new<P: AsRef<Path>>(path: P, append: bool) -> Result<Self, DatabaseError> {
        let file = if append {
            OpenOptions::new()
                .read(true)
                .create(true)
                .append(true)
                .open(path.as_ref())?
        } else {
            OpenOptions::new()
                .read(true)
                .create(true)
                .write(true)
                .truncate(true)
                .open(path.as_ref())?
        };
        Ok(Self {
            file,
            _phantom: std::marker::PhantomData::default(),
        })
    }
pub fn new < P : AsRef < Path > > ( path : P , append : bool ) -> Result < Self , DatabaseError > { let file = if append { OpenOptions :: new ( ) . read ( true ) . create ( true ) . append ( true ) . open ( path . as_ref ( ) ) ? } else { OpenOptions :: new ( ) . read ( true ) . create ( true ) . write ( true ) . truncate ( true ) . open ( path . as_ref ( ) ) ? } ; Ok ( Self { file , _phantom : std :: marker :: PhantomData :: default ( ) , } ) }
Creates a new client.
Creates a new client .
path
P
append
bool
path
P
append
bool
errors
Returns `std::io::Error` if it fails to open or create a new file.
Returns ` std :: io :: Error ` if it fails to open or create a new file .