pub struct EnvRw { /* private fields */ }
Expand description
Read-write handle for accessing environment that stores key-value databases
An environment can be opened using EnvBuilder
.
EnvRw
coerces to EnvRo
through Deref
coercion, thus all methods
of EnvRo
are available for EnvRw
as well.
Use EnvRo::open_db
or EnvRw::create_db
to retrieve database handles
and EnvRw::txn_rw
to start a read-write transaction.
It’s possible to create a read-only handle from a read-write handle by
invoking .clone()
, which clones the referenced EnvRo
through deref coercion (see
example for EnvBuilder
).
Implementations
sourceimpl EnvRw
impl EnvRw
sourcepub fn nestable_txns(&self) -> bool
pub fn nestable_txns(&self) -> bool
Check if transactions are nestable
See TxnRw::nested
.
sourcepub unsafe fn create_dbs<'a, K, V, C>(
&mut self,
options: impl IntoIterator<IntoIter = impl Iterator<Item = &'a DbOptions<K, V, C, Option<CString>>> + ExactSizeIterator>
) -> Result<Vec<Db<K, V, C>>, Error> where
K: ?Sized + Storable + 'a,
V: ?Sized + Storable + 'a,
C: Constraint,
pub unsafe fn create_dbs<'a, K, V, C>(
&mut self,
options: impl IntoIterator<IntoIter = impl Iterator<Item = &'a DbOptions<K, V, C, Option<CString>>> + ExactSizeIterator>
) -> Result<Vec<Db<K, V, C>>, Error> where
K: ?Sized + Storable + 'a,
V: ?Sized + Storable + 'a,
C: Constraint,
Open databases in environment and create if non-existing
SAFETY: If a database exists already, it must have been created with compatible options.
sourcepub unsafe fn create_db<K, V, C>(
&mut self,
options: &DbOptions<K, V, C, Option<CString>>
) -> Result<Db<K, V, C>, Error> where
K: ?Sized + Storable,
V: ?Sized + Storable,
C: Constraint,
pub unsafe fn create_db<K, V, C>(
&mut self,
options: &DbOptions<K, V, C, Option<CString>>
) -> Result<Db<K, V, C>, Error> where
K: ?Sized + Storable,
V: ?Sized + Storable,
C: Constraint,
Open database in environment and create if non-existing
SAFETY: If a database exists already, it must have been created with compatible options.
Methods from Deref<Target = EnvRo>
sourcepub fn max_keysize(&self) -> usize
pub fn max_keysize(&self) -> usize
Get maximum size of keys and duplicate data
sourcepub fn valid_keysize<'kr, K, KRef>(&self, key: KRef) -> bool where
K: ?Sized + Storable + 'kr,
KRef: StorableRef<'kr, K>,
pub fn valid_keysize<'kr, K, KRef>(&self, key: KRef) -> bool where
K: ?Sized + Storable + 'kr,
KRef: StorableRef<'kr, K>,
Checks if key or duplicate data has valid size
sourcepub unsafe fn open_dbs<'a, K, V, C>(
&self,
options: impl IntoIterator<IntoIter = impl Iterator<Item = &'a DbOptions<K, V, C, Option<CString>>> + ExactSizeIterator>
) -> Result<Vec<Db<K, V, C>>, Error> where
K: ?Sized + Storable + 'a,
V: ?Sized + Storable + 'a,
C: Constraint,
pub unsafe fn open_dbs<'a, K, V, C>(
&self,
options: impl IntoIterator<IntoIter = impl Iterator<Item = &'a DbOptions<K, V, C, Option<CString>>> + ExactSizeIterator>
) -> Result<Vec<Db<K, V, C>>, Error> where
K: ?Sized + Storable + 'a,
V: ?Sized + Storable + 'a,
C: Constraint,
Open databases in environment
SAFETY: If a database exists already, it must have been created with compatible options.
sourcepub unsafe fn open_db<K, V, C>(
&self,
options: &DbOptions<K, V, C, Option<CString>>
) -> Result<Db<K, V, C>, Error> where
K: ?Sized + Storable,
V: ?Sized + Storable,
C: Constraint,
pub unsafe fn open_db<K, V, C>(
&self,
options: &DbOptions<K, V, C, Option<CString>>
) -> Result<Db<K, V, C>, Error> where
K: ?Sized + Storable,
V: ?Sized + Storable,
C: Constraint,
Open database in environment
SAFETY: If a database exists already, it must have been created with compatible options.
sourcepub fn clear_stale_readers(&self) -> Result<(), Error>
pub fn clear_stale_readers(&self) -> Result<(), Error>
Clear stale readers
Refer to LMDB’s documentation when to clear stale readers
Trait Implementations
impl Eq for EnvRw
impl StructuralEq for EnvRw
impl StructuralPartialEq for EnvRw
Auto Trait Implementations
impl RefUnwindSafe for EnvRw
impl Send for EnvRw
impl Sync for EnvRw
impl Unpin for EnvRw
impl UnwindSafe for EnvRw
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