driller 0.10.0

Driller is a HTTP load testing application written in Rust inspired by Ansible syntax. Friendly fork of fcsonline/drill.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use std::fs::File;
use std::io::prelude::*;
use std::path::Path;

pub fn write_file(filepath: &str, content: String) {
  let path = Path::new(filepath);
  let display = path.display();

  let mut file = match File::create(path) {
    Err(why) => panic!("couldn't create {display}: {why:?}"),
    Ok(file) => file,
  };

  if let Err(why) = file.write_all(content.as_bytes()) {
    panic!("couldn't write to {display}: {why:?}");
  }
}