tcg_log_core_rs/lib.rs
1mod collector;
2mod wbcl;
3
4use crate::collector::Collector;
5pub use crate::collector::{EventRecord, DigestRecords};
6
7/// Parses the content of the given input file and returns a vector of `EventRecord` objects.
8///
9/// # Arguments
10///
11/// * `input_file` - A string slice that represents the path to the input file to be parsed.
12///
13/// # Returns
14///
15/// * `Ok(Vec<EventRecord>)` - A vector containing the parsed `EventRecord` objects if the parsing is successful.
16/// * `Err(String)` - An error message describing the failure if the parsing fails.
17///
18/// # Errors
19///
20/// Returns an error if:
21/// * The file cannot be read.
22/// * The content of the file cannot be parsed into `EventRecord` objects.
23///
24/// # Example
25///
26/// ```
27/// let input_file = "path/to/input/file.txt";
28/// match parse(input_file) {
29/// Ok(events) => {
30/// println!("Parsed events: {:?}", events);
31/// }
32/// Err(err) => {
33/// eprintln!("Error parsing file: {}", err);
34/// }
35/// }
36/// ```
37pub fn parse(input_file: &str) -> Result<Vec<EventRecord>, String> {
38 let col = Collector::new();
39 col.parse(input_file.to_string())
40}
41
42/*
43#[cfg(test)]
44mod tests {
45 use super::*;
46
47 #[test]
48 fn test_parse() {
49 let result = parse("D:/temp/markus.log");
50 }
51}
52*/