Add benchmark script

* Structure `cli` crate as both a library and an executable, so that
benchmarks can import code from the crate.
* Import macros in the Rust 2018 style.
This commit is contained in:
Max Brunsfeld 2019-02-01 14:39:37 -08:00
parent e26cbb62a5
commit 4cac85fec4
25 changed files with 244 additions and 92 deletions

View file

@ -8,18 +8,18 @@ use tree_sitter::Parser;
const HTML_HEADER: &[u8] = b"<!DOCTYPE html>\n<style>svg { width: 100%; }</style>\n\n";
#[cfg(windows)]
pub(crate) struct LogSession();
pub struct LogSession();
#[cfg(unix)]
pub(crate) struct LogSession(PathBuf, Option<Child>, Option<ChildStdin>);
pub struct LogSession(PathBuf, Option<Child>, Option<ChildStdin>);
#[cfg(windows)]
pub(crate) fn log_graphs(_parser: &mut Parser, _path: &str) -> std::io::Result<LogSession> {
pub fn log_graphs(_parser: &mut Parser, _path: &str) -> std::io::Result<LogSession> {
Ok(LogSession())
}
#[cfg(unix)]
pub(crate) fn log_graphs(parser: &mut Parser, path: &str) -> std::io::Result<LogSession> {
pub fn log_graphs(parser: &mut Parser, path: &str) -> std::io::Result<LogSession> {
use std::io::Write;
let mut dot_file = std::fs::File::create(path)?;