mirror of
https://gitlab.cern.ch/wotsubo/psboard-qaqc-postprocess.git
synced 2024-11-22 07:10:18 +09:00
refactor: replace MasterLogResult file parse API to use only filename
* old one moved to private and used in the new one * for future convert-master-log replacement
This commit is contained in:
parent
9e93a085fd
commit
7529d003a6
2 changed files with 18 additions and 15 deletions
14
src/main.rs
14
src/main.rs
|
@ -353,19 +353,7 @@ fn main() -> Result<()> {
|
||||||
master_log,
|
master_log,
|
||||||
outfile,
|
outfile,
|
||||||
} => {
|
} => {
|
||||||
let result = {
|
let result = MasterLogResult::parse_file(master_log)?;
|
||||||
let file = File::open(master_log.clone())?;
|
|
||||||
let reader = BufReader::new(file);
|
|
||||||
MasterLogResult::parse_file(
|
|
||||||
reader,
|
|
||||||
master_log
|
|
||||||
.file_name()
|
|
||||||
.unwrap()
|
|
||||||
.to_str()
|
|
||||||
.unwrap()
|
|
||||||
.to_string(),
|
|
||||||
)?
|
|
||||||
};
|
|
||||||
debug!("{:?}", result);
|
debug!("{:?}", result);
|
||||||
|
|
||||||
// Print boards to retest
|
// Print boards to retest
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use std::{
|
use std::{
|
||||||
collections::BTreeMap,
|
collections::BTreeMap,
|
||||||
io::{BufRead, Write},
|
fs::File,
|
||||||
|
io::{BufRead, BufReader, Write},
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
str::FromStr,
|
str::FromStr,
|
||||||
};
|
};
|
||||||
|
@ -107,7 +108,21 @@ fn extract_position_id(line: &str) -> Result<(Position, PsbId)> {
|
||||||
|
|
||||||
impl MasterLogResult {
|
impl MasterLogResult {
|
||||||
/// Parse log file on master jathub.
|
/// Parse log file on master jathub.
|
||||||
pub fn parse_file(file: impl BufRead, filename: String) -> Result<MasterLogResult> {
|
pub fn parse_file(master_log: PathBuf) -> Result<MasterLogResult> {
|
||||||
|
let file = File::open(master_log.clone())?;
|
||||||
|
let reader = BufReader::new(file);
|
||||||
|
MasterLogResult::parse_file_with_filename(
|
||||||
|
reader,
|
||||||
|
master_log
|
||||||
|
.file_name()
|
||||||
|
.unwrap()
|
||||||
|
.to_str()
|
||||||
|
.unwrap()
|
||||||
|
.to_string(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn parse_file_with_filename(file: impl BufRead, filename: String) -> Result<MasterLogResult> {
|
||||||
let mut lines = file.lines();
|
let mut lines = file.lines();
|
||||||
|
|
||||||
let version = {
|
let version = {
|
||||||
|
|
Loading…
Reference in a new issue