Struct libesedb::Record

source ·
pub struct Record<'a> { /* private fields */ }
Expand description

Instance of a ESE database record in a currently open crate::Table.

Implementations§

source§

impl Record<'_>

source

pub fn value(&self, entry: i32) -> Result<Value>

Load a specific column/field value by entry number. Returned Value is bound to the lifetime of the database record.

source

pub fn count_values(&self) -> Result<i32>

Returns number of values (columns/fields) in the record.

source

pub fn iter_values(&self) -> Result<impl Iterator<Item = Result<Value>> + '_>

Create an iterator over all the (column/field) values in the table record. The [IterEntries] iterator and the returned Values are bound to the lifetime of the database record.

for value in record.iter_values()? {
    println!("{:?}", value?);
}
Examples found in repository?
examples/fh-catalog-strings.rs (line 13)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
fn main() {
    let filename = std::env::args()
        .nth(1)
        .unwrap_or("Catalog1.edb".to_string());
    let db = EseDb::open(filename).unwrap();
    println!("Db load finished!");
    let string = db.table_by_name("string").unwrap();
    for rec in string.iter_records().unwrap() {
        let rec = rec.unwrap();
        let vals = rec
            .iter_values()
            .unwrap()
            .map(|v| v.unwrap_or_default().to_string())
            .collect::<Vec<_>>();
        println!("{}", vals.join("\t"));
    }
}
source

pub fn close(self)

When done reading, call this to free resources the record is using in memory.

Trait Implementations§

source§

impl Drop for Record<'_>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for Record<'a>

§

impl<'a> !Send for Record<'a>

§

impl<'a> !Sync for Record<'a>

§

impl<'a> Unpin for Record<'a>

§

impl<'a> UnwindSafe for Record<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.