rumeter-component 0.1.3

A load test platform for writing a load test script by rust. Just like JMeter, but it prefer using like SDK, not a GUI tool.
Documentation
use std::{fs, io::Write};

use crate::{Output, record::{TITLE_NAMES, RecordData}};

pub struct FileOutput {
    file: fs::File,
}

impl FileOutput {
    pub fn new(file: fs::File) -> Self {
        let mut f = file;
        let s = format!("{}\n", TITLE_NAMES.join(","));
        f.write_all(s.as_bytes()).unwrap();
        Self { file: f }
    } 
}

impl Output for FileOutput {
    fn write(&mut self, data: RecordData) {
        self.file.write_all(format!("{}\n", data).as_bytes()).unwrap();
    }
}