Trait mmtkvdb::EnvRef

source ·
pub trait EnvRef {
    // Required methods
    unsafe fn open_or_create_dbs<'a, K, V, C>(
&mut self,
options: impl IntoIterator<IntoIter = impl Iterator<Item = &'a DbSpec<K, V, C>> + ExactSizeIterator>
) -> Result<Vec<Db<K, V, C>>>
where K: Storable + ?Sized + 'a,
V: Storable + ?Sized + 'a,
C: Constraint
; unsafe fn open_or_create_db<K, V, C>(
&mut self,
options: &DbSpec<K, V, C>
) -> Result<Db<K, V, C>>
where K: Storable + ?Sized,
V: Storable + ?Sized,
C: Constraint
; }
Expand description

Abstraction over &EnvRo and &mut EnvRw, which allows creating databases in the latter case if non-existing

This trait is only needed if you want to create generic code which works on either &EnvRo or &mut EnvRw and creates databases in the latter case if non-existing. In most cases, EnvRo or EnvRw can be used directly. (Note that you can call EnvRo’s methods on EnvRw automatically due to Deref coercion.)

Required Methods§

source

unsafe fn open_or_create_dbs<'a, K, V, C>(
&mut self,
options: impl IntoIterator<IntoIter = impl Iterator<Item = &'a DbSpec<K, V, C>> + ExactSizeIterator>
) -> Result<Vec<Db<K, V, C>>>where
K: Storable + ?Sized + 'a,
V: Storable + ?Sized + 'a,
C: Constraint,

Open databases in environment and, if possible, create if non-existing

Note that the implementation of EnvRef for &EnvRo does not create any database if non-existing.

SAFETY: If a database exists already, it must have been created with compatible options.

source

unsafe fn open_or_create_db<K, V, C>(
&mut self,
options: &DbSpec<K, V, C>
) -> Result<Db<K, V, C>>where
K: Storable + ?Sized,
V: Storable + ?Sized,
C: Constraint,

Open database in environment and, if possible, create if non-existing

Note that the implementation of EnvRef for &EnvRo does not create any database if non-existing.

SAFETY: If a database exists already, it must have been created with compatible options.

Implementors§

source§

impl EnvRef for &EnvRo

source§

impl EnvRef for &mut EnvRw