Struct redb::DatabaseBuilder
source · [−]pub struct DatabaseBuilder { /* private fields */ }
Implementations
sourceimpl DatabaseBuilder
impl DatabaseBuilder
pub fn new() -> Self
sourcepub fn set_page_size(&mut self, size: usize) -> &mut Self
pub fn set_page_size(&mut self, size: usize) -> &mut Self
Set the internal page size of the database Larger page sizes will reduce the database file’s overhead, but may decrease write performance Defaults to the native OS page size
sourcepub fn set_region_size(&mut self, size: usize) -> &mut Self
pub fn set_region_size(&mut self, size: usize) -> &mut Self
Set the internal region size of the database Smaller regions may allow the database to compact more effectively, but will limit the maximum size of values that can be stored Defaults to 4GiB
sourcepub fn set_dynamic_growth(&mut self, enabled: bool) -> &mut Self
pub fn set_dynamic_growth(&mut self, enabled: bool) -> &mut Self
Whether to grow the database file dynamically. When set to true, the database file will start at a small size and grow as insertions are made When set to false, the database file will be statically sized
sourcepub unsafe fn create(
&self,
path: impl AsRef<Path>,
db_size: usize
) -> Result<Database, Error>
pub unsafe fn create(
&self,
path: impl AsRef<Path>,
db_size: usize
) -> Result<Database, Error>
Opens the specified file as a redb database.
- if the file does not exist, or is an empty file, a new database will be initialized in it
- if the file is a valid redb database, it will be opened
- otherwise this function will return an error
db_size
: the maximum size in bytes of the database.
Safety
The file referenced by path
must not be concurrently modified by any other process
Auto Trait Implementations
impl RefUnwindSafe for DatabaseBuilder
impl Send for DatabaseBuilder
impl Sync for DatabaseBuilder
impl Unpin for DatabaseBuilder
impl UnwindSafe for DatabaseBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more