pub struct Record<'a> { /* private fields */ }Expand description
Instance of a ESE database record in a currently open crate::Table.
Implementations§
source§impl Record<'_>
impl Record<'_>
sourcepub fn value(&self, entry: i32) -> Result<Value>
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.
sourcepub fn count_values(&self) -> Result<i32>
pub fn count_values(&self) -> Result<i32>
Returns number of values (columns/fields) in the record.
sourcepub fn iter_values(&self) -> Result<impl Iterator<Item = Result<Value>> + '_>
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"));
}
}Trait Implementations§
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> 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