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>>
impl StdfReader<BufReader<File>>
Source§impl<R: BufRead + Seek> StdfReader<R>
impl<R: BufRead + Seek> StdfReader<R>
Sourcepub fn from(
in_stream: R,
compress_type: &CompressType,
) -> Result<Self, StdfError>
pub fn from( in_stream: R, compress_type: &CompressType, ) -> Result<Self, StdfError>
Consume a input stream and generate a StdfReader, if successful
Sourcepub fn get_record_iter(&mut self) -> RecordIter<'_, R> ⓘ
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.
Sourcepub fn get_rawdata_iter(&mut self) -> RawDataIter<'_, R> ⓘ
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.
Sourcepub fn get_rawdata_view_iter(&mut self) -> RawDataViewIter<'_, R>
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.