pub struct DB { /* private fields */ }
Expand description
A database
A DB can created from an OpenOptions
builder, or by calling open
.
From a DB, you can create a Tx
to access the data in the database.
If you want to use the database across threads, so you can clone
the database
to have concurrent transactions (you’re really just cloning an Arc
so it’s pretty cheap).
Do not try to open multiple transactions in the same thread, you’re pretty likely to cause a deadlock.
Implementations§
source§impl DB
impl DB
sourcepub fn open<P: AsRef<Path>>(path: P) -> Result<DB, Error>
pub fn open<P: AsRef<Path>>(path: P) -> Result<DB, Error>
Opens a database using the default OpenOptions
.
Same as calling OpenOptions::new().open(path)
.
Please read the documentation for OpenOptions::open
for details.
Examples
use jammdb::{DB};
let db = DB::open("my.db")?;
// do whatever you want with the DB
Trait Implementations§
Auto Trait Implementations§
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