[][src]Struct kv::Config

pub struct Config {
    pub map_size: usize,
    pub max_readers: u32,
    pub path: PathBuf,
    pub readonly: bool,
    pub buckets: HashMap<String, Flag>,
    // some fields omitted
}

Config is used to create a new store

Fields

map_size: usize

The map_size field determines the maximum number of bytes stored in the database

max_readers: u32

The max_readers field determines the maximum number of readers for a given database

path: PathBuf

The path field determines where the database will be created

readonly: bool

Readonly sets the MDB_RDONLY flag when opening the database

buckets: HashMap<String, Flag>

Whitelisted buckets and DatabaseFlags

Methods

impl Config[src]

pub fn default<P: AsRef<Path>>(p: P) -> Config[src]

Create a default configuration object

pub fn save_to<W: Write>(&self, w: W) -> Result<(), Error>[src]

Save Config to an io::Write

pub fn save<P: AsRef<Path>>(&self, path: P) -> Result<(), Error>[src]

Save Config to a file

pub fn load_from<R: Read>(r: R) -> Result<Config, Error>[src]

Load configuration from an io::Read

pub fn load<P: AsRef<Path>>(path: P) -> Result<Config, Error>[src]

Load configuration to a file

pub fn set_map_size(&mut self, n: usize) -> &mut Config[src]

Set map_size field

pub fn set_max_readers(&mut self, n: u32) -> &mut Config[src]

Set max_readers field

pub fn flags(&self) -> EnvironmentFlags[src]

Get flags field (DatabaseFlags)

pub fn flag(&mut self, f: EnvironmentFlags) -> &mut Config[src]

Set flags field (DatabaseFlags)

pub fn set_path<P: AsRef<Path>>(&mut self, p: P) -> &mut Config[src]

Set path field

pub fn bucket<S: AsRef<str>>(&mut self, name: S, f: Option<Flag>) -> &mut Config[src]

Add a bucket

pub fn readonly(&mut self, readonly: bool) -> &mut Config[src]

Set to readonly

Trait Implementations

impl PartialEq<Config> for Config[src]

impl Clone for Config[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Config[src]

impl Serialize for Config[src]

impl<'de> Deserialize<'de> for Config[src]

Auto Trait Implementations

impl Send for Config

impl Unpin for Config

impl Sync for Config

impl UnwindSafe for Config

impl RefUnwindSafe for Config

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]