You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here is a simple example to show you how to iterate records in a STDF V4 file. There is a rather complex example in the github repo shows how to use existing APIs to convert STDF to Excel xlsx file.
use rust_stdf::{stdf_file::*, stdf_record_type::*,StdfRecord};fnmain(){let stdf_path = "demo_file.stdf";// "demo_file.stdf.gz" "demo_file.stdf.bz2"letmut reader = matchStdfReader::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.letmut dut_count:u64 = 0;letmut continuity_rlt = vec![];// use type filter to work on certain types,// use `|` to combine multiple typslet 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);}
About
A Rust STDF library for process STDF datalogs of Version V4 and V4-2007