Struct cdb::CDB

source ·
pub struct CDB { /* private fields */ }
Expand description

CDB file reader

Example

let cdb = cdb::CDB::open("tests/test1.cdb").unwrap();

for result in cdb.find(b"one") {
    println!("{:?}", result.unwrap());
}

Implementations

Opens the named file and returns the CDB reader.

Examples
let cdb = cdb::CDB::open("tests/test1.cdb").unwrap();

Find the first record with the named key.

Examples
let cdb = cdb::CDB::open("tests/test1.cdb").unwrap();
if let Some(record) = cdb.get(b"one") {
    println!("{:?}", record.unwrap());
}

Find all records with the named key. The returned iterator produces each value associated with the key.

Examples
let cdb = cdb::CDB::open("tests/test1.cdb").unwrap();

for result in cdb.find(b"one") {
    println!("{:?}", result.unwrap());
}

Iterate over all the (key, value) pairs in the database.

Examples
let cdb = cdb::CDB::open("tests/test1.cdb").unwrap();
for result in cdb.iter() {
    let (key, value) = result.unwrap();
    println!("{:?} => {:?}", key, value);
}

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.