Skip to main content

StdfReader

Struct StdfReader 

Source
pub struct StdfReader<R> { /* private fields */ }
Expand description

STDF Reader

This reader can process STDF datalogs of Version V4 and V4-2007

Supported compression:

  • Uncompressed
  • Gzip (.gz)
  • Bzip (.bz2)

§Example

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

let stdf_path = "demo_file.stdf";
let mut reader = match StdfReader::new(&stdf_path) {
    Ok(r) => r,
    Err(e) => {
        println!("{}", e);
        return;
    }
};

// we will count total DUT# in the file
// and put test result of PTR named
// "continuity test" in a vector.
let mut dut_count: u64 = 0;
let mut continuity_rlt = vec![];

// use type filter to work on certain types,
// use `|` to combine multiple typs
let rec_types = REC_PIR | REC_PTR;
// iterator starts from current file position,
// if file hits EOF, it will NOT redirect to 0.
for rec in reader
    .get_record_iter()
    .map(|x| x.unwrap())
    .filter(|x| x.is_type(rec_types))
{
    match rec {
        StdfRecord::PIR(_) => {dut_count += 1;}
        StdfRecord::PTR(ref ptr_rec) => {
            if ptr_rec.test_txt == "continuity test" {
                continuity_rlt.push(ptr_rec.result);
            }
        }
        _ => {}
    }
}
println!("Total duts {} \n continuity result {:?}",
        dut_count,
        continuity_rlt);

Implementations§

Source§

impl StdfReader<BufReader<File>>

Source

pub fn new<P>(path: P) -> Result<Self, StdfError>
where P: AsRef<Path>,

Open the given file and return a StdfReader, if successful

Source§

impl<R: BufRead + Seek> StdfReader<R>

Source

pub fn from( in_stream: R, compress_type: &CompressType, ) -> Result<Self, StdfError>

Consume a input stream and generate a StdfReader, if successful

Source

pub fn get_byte_order(&self) -> ByteOrder

Return the endianness of the STDF file.

Source

pub fn get_record_iter(&mut self) -> RecordIter<'_, R> ⓘ

Return an iterator for StdfRecord.

The iterator yields records starting from the current file position onward.

Source

pub fn get_rawdata_iter(&mut self) -> RawDataIter<'_, R> ⓘ

Return an iterator for unprocessed STDF bytes RawDataElement.

The iterator yields records starting from the current file position onward, and the offset field is counted relative to that position.

Source

pub fn get_rawdata_view_iter(&mut self) -> RawDataViewIter<'_, R>

Return a buffer-reusing iterator for unprocessed STDF bytes RawDataElementView.

Unlike get_rawdata_iter, the yielded RawDataElementView borrows the iterator’s reused buffer, so it performs no per-record allocation. See RawDataViewIter for usage.

The iterator yields records starting from the current file position onward, and the offset field is counted relative to that position.

Auto Trait Implementations§

§

impl<R> !RefUnwindSafe for StdfReader<R>

§

impl<R> !UnwindSafe for StdfReader<R>

§

impl<R> Freeze for StdfReader<R>
where StdfStream<R>: Freeze,

§

impl<R> Send for StdfReader<R>
where StdfStream<R>: Send,

§

impl<R> Sync for StdfReader<R>
where StdfStream<R>: Sync,

§

impl<R> Unpin for StdfReader<R>
where StdfStream<R>: Unpin,

§

impl<R> UnsafeUnpin for StdfReader<R>
where StdfStream<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.