Struct RecordRef

Source
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.

Implementations§

Source§

impl<'a, T> RecordRef<'a, T>

Source

pub fn field<'b>(&'b mut self, index: FieldIndex) -> Option<FieldRef<'b, T>>

Source§

impl<'a, T> RecordRef<'a, T>
where T: Seek,

Source§

impl<'a, T> RecordRef<'a, T>
where T: Read + Seek,

Source

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
Source

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();

Source

pub fn read_field_as<ValueType>( &mut self, field_index: FieldIndex, ) -> Result<ValueType, Error>
where ValueType: TryFrom<FieldValue, Error = FieldConversionError>,

reads a field from the record

Shortcut for .field(index).unwrap().read_as().unwrap();

Source

pub fn read(&mut self) -> Result<Record, Error>

Reads the record

Source

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>
where T: Write + Seek,

Source

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();

Source

pub fn write<R>(&mut self, record: &R) -> Result<(), Error>
where R: WritableRecord,

Writes the content of record ath the position pointed by self.

Trait Implementations§

Source§

impl<'a, T> Debug for RecordRef<'a, T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.