pub struct DbOptions { /* private fields */ }Available on crate feature
std only.Expand description
Options for opening a Db, built fluently and finished with
open.
Use this when the default Db::open is not enough — currently, to choose a
SyncPolicy. The set of options is intentionally small and will only grow
additively.
§Examples
use bison_db::{DbOptions, SyncPolicy};
let db = DbOptions::new().sync(SyncPolicy::Always).open(&path)?;
assert_eq!(db.sync_policy(), SyncPolicy::Always);Implementations§
Source§impl DbOptions
impl DbOptions
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates options with the defaults (SyncPolicy::Manual).
§Examples
use bison_db::{DbOptions, SyncPolicy};
assert_eq!(DbOptions::new().build_sync_policy(), SyncPolicy::Manual);Sourcepub fn sync(self, policy: SyncPolicy) -> Self
pub fn sync(self, policy: SyncPolicy) -> Self
Sets the SyncPolicy for the store.
§Examples
use bison_db::{DbOptions, SyncPolicy};
let opts = DbOptions::new().sync(SyncPolicy::Always);
assert_eq!(opts.build_sync_policy(), SyncPolicy::Always);Sourcepub fn build_sync_policy(&self) -> SyncPolicy
pub fn build_sync_policy(&self) -> SyncPolicy
Returns the SyncPolicy these options currently carry.
§Examples
use bison_db::{DbOptions, SyncPolicy};
assert_eq!(DbOptions::new().build_sync_policy(), SyncPolicy::Manual);Trait Implementations§
Auto Trait Implementations§
impl Freeze for DbOptions
impl RefUnwindSafe for DbOptions
impl Send for DbOptions
impl Sync for DbOptions
impl Unpin for DbOptions
impl UnsafeUnpin for DbOptions
impl UnwindSafe for DbOptions
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