Skip to main content

RawDataViewIter

Struct RawDataViewIter 

Source
pub struct RawDataViewIter<'a, R> { /* private fields */ }
Expand description

Iterator over unprocessed STDF records that borrows the record bytes, created by StdfReader::get_rawdata_view_iter.

Each item is an unprocessed RawDataElementView that borrows record data buffer.

This iterator outperforms RawDataIter because there is no allocation, but it cannot implement Iterator, so it can only be driven by next.

The yielded item is only valid until the following next call.

§Example

use rust_stdf::{stdf_file::*, stdf_record_type::*, StdfRecordView};

let mut reader = StdfReader::new("demo_file.stdf").unwrap();
let mut iter = reader.get_rawdata_view_iter();
while let Some(item) = iter.next() {
    let raw = item.unwrap();
    if !raw.is_type(REC_PTR) {
        continue;
    }
    let rec_view: StdfRecordView = (&raw).into();
    if let StdfRecordView::PTR(ptr) = rec_view {
        println!("{}", ptr.result());
    }
}

Implementations§

Source§

impl<R: BufRead + Seek> RawDataViewIter<'_, R>

Source

pub fn next(&mut self) -> Option<Result<RawDataElementView<'_>, StdfError>>

Advance the iterator, returning the next RawDataElementView, or None at EOF.

The returned item will be invalidated by the following call.

It mirrors Iterator::next but cannot be part of the Iterator trait because the item borrows from self.

Auto Trait Implementations§

§

impl<'a, R> !RefUnwindSafe for RawDataViewIter<'a, R>

§

impl<'a, R> !UnwindSafe for RawDataViewIter<'a, R>

§

impl<'a, R> Freeze for RawDataViewIter<'a, R>
where &'a mut StdfReader<R>: Freeze,

§

impl<'a, R> Send for RawDataViewIter<'a, R>
where &'a mut StdfReader<R>: Send,

§

impl<'a, R> Sync for RawDataViewIter<'a, R>
where &'a mut StdfReader<R>: Sync,

§

impl<'a, R> Unpin for RawDataViewIter<'a, R>
where &'a mut StdfReader<R>: Unpin,

§

impl<'a, R> UnsafeUnpin for RawDataViewIter<'a, R>
where &'a mut StdfReader<R>: UnsafeUnpin,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.