pub struct RedbDatabase { /* private fields */ }Expand description
Redb backend implementation.
Redb is a simple, portable, high-performance, ACID, embedded key-value database. A CrepeDB backend implementation using redb.
This struct wraps a redb Database and implements the CrepeDB Backend trait,
allowing redb to be used as the storage engine for CrepeDB.
Implementations§
Source§impl RedbDatabase
impl RedbDatabase
Sourcepub fn open_or_create(path: impl AsRef<Path>) -> Result<RedbDatabase, Error>
pub fn open_or_create(path: impl AsRef<Path>) -> Result<RedbDatabase, Error>
Open or create a persistent redb database at the specified path.
If the database doesn’t exist, it will be created. If it exists, it will be opened.
§Arguments
path- The file path where the database should be stored
§Errors
Returns an error if the database cannot be created or opened.
§Example
ⓘ
let db = RedbDatabase::open_or_create("mydb.redb")?;Sourcepub fn memory() -> Result<RedbDatabase, Error>
pub fn memory() -> Result<RedbDatabase, Error>
Sourcepub fn into_inner(self) -> Database
pub fn into_inner(self) -> Database
Consume the database and return the underlying redb database.
Trait Implementations§
Source§impl Backend for RedbDatabase
impl Backend for RedbDatabase
Source§type ReadTxn<'a> = RedbReadTxn
type ReadTxn<'a> = RedbReadTxn
The read transaction type.
Source§type WriteTxn<'a> = RedbWriteTxn
type WriteTxn<'a> = RedbWriteTxn
The write transaction type.
Auto Trait Implementations§
impl Freeze for RedbDatabase
impl !RefUnwindSafe for RedbDatabase
impl Send for RedbDatabase
impl Sync for RedbDatabase
impl Unpin for RedbDatabase
impl !UnwindSafe for RedbDatabase
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