Skip to main content

from_path

Function from_path 

Source
pub fn from_path<P>(path: P) -> Result<Har, Error>
where P: AsRef<Path>,
Expand description

Deserialize a HAR from a path.

Examples found in repository?
examples/printer.rs (line 9)
3fn main() {
4    let Some(path) = std::env::args_os().nth(1) else {
5        eprintln!("usage: cargo run --example printer -- <path-to.har>");
6        std::process::exit(2);
7    };
8
9    match from_path(&path) {
10        Ok(har) => {
11            let json = to_json(&har).expect("serializing parsed HAR as JSON should succeed");
12            println!("{json}");
13        }
14        Err(error) => {
15            eprintln!("{error}");
16            std::process::exit(1);
17        }
18    }
19}