[−][src]Struct heed::EnvOpenOptions
Methods
impl EnvOpenOptions
[src]
pub fn new() -> EnvOpenOptions
[src]
pub fn map_size(&mut self, size: usize) -> &mut Self
[src]
pub fn max_readers(&mut self, readers: u32) -> &mut Self
[src]
pub fn max_dbs(&mut self, dbs: u32) -> &mut Self
[src]
pub unsafe fn flag(&mut self, flag: Flags) -> &mut Self
[src]
Set one or more LMDB flags (see http://www.lmdb.tech/doc/group__mdb__env.html).
use std::fs; use heed::{EnvOpenOptions, Database}; use heed::types::*; use heed::flags::Flags; fs::create_dir_all("target/zerocopy.mdb")?; let mut env_builder = EnvOpenOptions::new(); unsafe { env_builder.flag(Flags::MdbNoSync); env_builder.flag(Flags::MdbNoMetaSync); } let env = env_builder.open("target/zerocopy.mdb")?; // we will open the default unamed database let db: Database<Str, OwnedType<i32>> = env.create_database(None)?; // opening a write transaction let mut wtxn = env.write_txn()?; db.put(&mut wtxn, "seven", &7)?; db.put(&mut wtxn, "zero", &0)?; db.put(&mut wtxn, "five", &5)?; db.put(&mut wtxn, "three", &3)?; wtxn.commit()?; // Force the OS to flush the buffers (see Flags::MdbNoSync and Flags::MdbNoMetaSync). env.force_sync(); // opening a read transaction // to check if those values are now available let mut rtxn = env.read_txn()?; let ret = db.get(&rtxn, "zero")?; assert_eq!(ret, Some(0)); let ret = db.get(&rtxn, "five")?; assert_eq!(ret, Some(5));
pub fn open<P: AsRef<Path>>(&self, path: P) -> Result<Env>
[src]
Trait Implementations
impl Clone for EnvOpenOptions
[src]
fn clone(&self) -> EnvOpenOptions
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for EnvOpenOptions
[src]
Auto Trait Implementations
impl Send for EnvOpenOptions
impl Sync for EnvOpenOptions
impl Unpin for EnvOpenOptions
impl UnwindSafe for EnvOpenOptions
impl RefUnwindSafe for EnvOpenOptions
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,