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_record_iter(&mut self) -> RecordIter<'_, R>

return an iterator for StdfRecord

Only the records after the current file position can be read.

Source

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

return an iterator for unprocessed STDF bytes

beware that internal offset counter is starting from the current position.

Auto Trait Implementations§

§

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

§

impl<R> !RefUnwindSafe for StdfReader<R>

§

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

§

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

§

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

§

impl<R> !UnwindSafe for StdfReader<R>

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.