pub struct Table<'a> { /* private fields */ }Expand description
Instance of a ESE database table in a currently open crate::EseDb.
Implementations§
source§impl Table<'_>
impl Table<'_>
sourcepub fn count_columns(&self) -> Result<i32>
pub fn count_columns(&self) -> Result<i32>
Total number of columns in table.
sourcepub fn count_records(&self) -> Result<i32>
pub fn count_records(&self) -> Result<i32>
Total number of records (rows) in table.
sourcepub fn column(&self, entry: i32) -> Result<Column<'_>>
pub fn column(&self, entry: i32) -> Result<Column<'_>>
Load a specific column by entry number.
Returned Column is bound to the lifetime of the database table.
sourcepub fn record(&self, entry: i32) -> Result<Record<'_>>
pub fn record(&self, entry: i32) -> Result<Record<'_>>
Load a specific record (row) by entry number.
Returned Record is bound to the lifetime of the database table.
sourcepub fn iter_columns(&self) -> Result<impl Iterator<Item = Result<Column<'_>>>>
pub fn iter_columns(&self) -> Result<impl Iterator<Item = Result<Column<'_>>>>
Create an iterator over all the columns in the table.
The [IterEntries] iterator and the returned Columns
are bound to the lifetime of the database table.
for column in table.iter_columns()? {
println!("{}", column?.name()?);
}sourcepub fn iter_records(&self) -> Result<impl Iterator<Item = Result<Record<'_>>>>
pub fn iter_records(&self) -> Result<impl Iterator<Item = Result<Record<'_>>>>
Create an iterator over all the records (rows) in the table.
The [IterEntries] iterator and the returned Records
are bound to the lifetime of the database table.
for record in table.iter_records()? {
let record = record?;
for value in record.iter_values()? {
println!("{:?}", value?);
}
}Examples found in repository?
examples/fh-catalog-strings.rs (line 10)
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"));
}
}Trait Implementations§
Auto Trait Implementations§
impl<'a> RefUnwindSafe for Table<'a>
impl<'a> !Send for Table<'a>
impl<'a> !Sync for Table<'a>
impl<'a> Unpin for Table<'a>
impl<'a> UnwindSafe for Table<'a>
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