[−][src]Struct persy::OpenOptions
Options, flags, configs which can be used to configure how a persy database is opened.
use persy::{OpenOptions, Persy, PersyId, PRes, ValueMode}; // This function will only be called on database creation fn init(persy: &Persy) -> PRes<()> { let mut tx = persy.begin()?; persy.create_segment(&mut tx, "data")?; persy.create_index::<u64, PersyId>(&mut tx, "index", ValueMode::REPLACE)?; let prepared = persy.prepare_commit(tx)?; persy.commit(prepared)?; println!("Segment and Index successfully created"); Ok(()) } let persy = OpenOptions::new().create(true).prepare_with(init).open("target/persy.db")?;
Methods
impl OpenOptions
[src]
pub fn new() -> OpenOptions
[src]
pub fn truncate(&mut self, truncate: bool) -> &mut OpenOptions
[src]
pub fn create(&mut self, create: bool) -> &mut OpenOptions
[src]
pub fn create_new(&mut self, create_new: bool) -> &mut OpenOptions
[src]
pub fn prepare_with<F>(&mut self, prepare: F) -> &mut OpenOptions where
F: Fn(&Persy) -> PRes<()> + 'static,
[src]
F: Fn(&Persy) -> PRes<()> + 'static,
pub fn recover_with<F>(&mut self, recover: F) -> &mut OpenOptions where
F: Fn(&Vec<u8>) -> bool + 'static,
[src]
F: Fn(&Vec<u8>) -> bool + 'static,
pub fn config(&mut self, config: Config) -> &mut OpenOptions
[src]
pub fn open<P>(&mut self, path: P) -> PRes<Persy> where
P: AsRef<Path>,
[src]
P: AsRef<Path>,
Trait Implementations
impl Default for OpenOptions
[src]
fn default() -> OpenOptions
[src]
Auto Trait Implementations
impl !Send for OpenOptions
impl !Sync for OpenOptions
impl Unpin for OpenOptions
impl !UnwindSafe for OpenOptions
impl !RefUnwindSafe for OpenOptions
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, 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,