[][src]Struct tinycdb::CdbCreator

pub struct CdbCreator { /* fields omitted */ }

The CdbCreator struct is used while building a new CDB instance.

Implementations

impl CdbCreator[src]

pub fn add(&mut self, key: &[u8], val: &[u8]) -> CdbResult<()>[src]

add(key, val) adds the given key/value pair to the database, silently overwriting any previously-existing value. It returns whether or not the operation succeeded. Note that if this call panics, it is unsafe to continue building the database.

pub fn exists(&mut self, key: &[u8]) -> CdbResult<bool>[src]

exists(key) checks whether the given key exists within the database. Note that this may slow down creation, as it results in the underlying C library flushing the internal buffer to disk on every call.

pub fn remove(&mut self, key: &[u8], zero: bool) -> CdbResult<bool>[src]

remove(key) will remove the given key from the database. If the zero parameter is true, then an existing key/value pair will be zeroed out in the database. This prevents it from being found in normal lookups, but it will still be present in sequential scans of the database. If the zero parameter is false, then the entire record will be removed from the database. Note, however, that removing a record also involves moving other records in the database, and may take much longer to complete. Note that a remove() of the most recently-added key, regardless of the the zero parameter, will always remove it from the database entirely. The return value from this function indicates whether or not any keys were removed.

pub fn put(
    &mut self,
    key: &[u8],
    val: &[u8],
    mode: CdbPutMode
) -> CdbResult<bool>
[src]

put(key, val, mode) will add a new key to the database, with a configurable behaviour if the key already exists. See the documentation on CdbPutMode for more information on the options available. The return value from this function indicates whether or not any existing keys were found in the database during the put operation.

Trait Implementations

impl Drop for CdbCreator[src]

Auto Trait Implementations

impl RefUnwindSafe for CdbCreator

impl !Send for CdbCreator

impl !Sync for CdbCreator

impl Unpin for CdbCreator

impl UnwindSafe for CdbCreator

Blanket Implementations

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

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

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

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.