pub struct DB { /* private fields */ }
Expand description
Represents the main database instance.
DB
is the entry point for all database interactions. It handles the
underlying storage and provides methods to create read-only or read-write
transactions.
Implementations§
Source§impl DB
impl DB
Sourcepub fn open_or_create<P: AsRef<Path>>(path: P) -> Result<Self>
pub fn open_or_create<P: AsRef<Path>>(path: P) -> Result<Self>
Opens an existing database file or creates a new one if it doesn’t exist.
Uses default settings. If you need customization, use
DBBuilder::new
instead.
§Parameters
path
: A path to the database file.
§Errors
Returns TxnError
if the database file cannot be opened or created,
or if there’s an issue initializing the memory map.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DB
impl !RefUnwindSafe for DB
impl Send for DB
impl Sync for DB
impl Unpin for DB
impl !UnwindSafe for DB
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more