pub struct RecordRef<'a, T> { /* private fields */ }Expand description
‘reference’ to a record in a dBase file.
This can be used to read/write the whole record at once, or select a particular field in the file Self::field.
- Allows to read the field content via Self::read or Self::read_as
- Allows to overwrite the field content via Self::write
Implementations§
Source§impl<'a, T> RecordRef<'a, T>
impl<'a, T> RecordRef<'a, T>
pub fn field<'b>(&'b mut self, index: FieldIndex) -> Option<FieldRef<'b, T>>
Source§impl<'a, T> RecordRef<'a, T>where
T: Seek,
impl<'a, T> RecordRef<'a, T>where
T: Seek,
pub fn seek_before_deletion_flag(&mut self) -> Result<u64, FieldIOError>
Source§impl<'a, T> RecordRef<'a, T>
impl<'a, T> RecordRef<'a, T>
Sourcepub fn is_deleted(&mut self) -> Result<bool, Error>
pub fn is_deleted(&mut self) -> Result<bool, Error>
Returns the value of the special deletion flag
- true -> the record is marked as deleted
- false -> the record is not marked as deleted
Sourcepub fn read_field(
&mut self,
field_index: FieldIndex,
) -> Result<FieldValue, Error>
pub fn read_field( &mut self, field_index: FieldIndex, ) -> Result<FieldValue, Error>
reads a field from the record
Shortcut for .field(index).unwrap().read().unwrap();
Sourcepub fn read_field_as<ValueType>(
&mut self,
field_index: FieldIndex,
) -> Result<ValueType, Error>
pub fn read_field_as<ValueType>( &mut self, field_index: FieldIndex, ) -> Result<ValueType, Error>
reads a field from the record
Shortcut for .field(index).unwrap().read_as().unwrap();
Sourcepub fn read_as<R>(&mut self) -> Result<R, Error>where
R: ReadableRecord,
pub fn read_as<R>(&mut self) -> Result<R, Error>where
R: ReadableRecord,
Reads the record as the given type
Source§impl<'a, T> RecordRef<'a, T>
impl<'a, T> RecordRef<'a, T>
Sourcepub fn write_field<ValueType>(
&mut self,
field_index: FieldIndex,
value: &ValueType,
) -> Result<(), Error>where
ValueType: WritableAsDbaseField,
pub fn write_field<ValueType>(
&mut self,
field_index: FieldIndex,
value: &ValueType,
) -> Result<(), Error>where
ValueType: WritableAsDbaseField,
writes a field to the record
Shortcut for .field(index).unwrap().write(&value).unwrap();
Trait Implementations§
Auto Trait Implementations§
impl<'a, T> Freeze for RecordRef<'a, T>
impl<'a, T> !RefUnwindSafe for RecordRef<'a, T>
impl<'a, T> Send for RecordRef<'a, T>where
T: Send,
impl<'a, T> !Sync for RecordRef<'a, T>
impl<'a, T> Unpin for RecordRef<'a, T>
impl<'a, T> !UnwindSafe for RecordRef<'a, T>
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