Browse Source

swaps in the dirs crate home_dir() instead of deprecated std fn

master
Jonathan Strong 5 years ago
parent
commit
2b303be4ec
3 changed files with 5 additions and 2 deletions
  1. +1
    -0
      Cargo.toml
  2. +3
    -2
      src/hist.rs
  3. +1
    -0
      src/lib.rs

+ 1
- 0
Cargo.toml View File

@@ -27,6 +27,7 @@ hdrhistogram = "6"
slog-async = "2"
smallvec = "0.6"
num = "0.1"
dirs = "1"

sloggers = { path = "../sloggers" }



+ 3
- 2
src/hist.rs View File

@@ -4,8 +4,9 @@ use std::time::{Instant, Duration, SystemTime, UNIX_EPOCH};
use std::path::PathBuf;
use std::thread::{self, JoinHandle};
use std::io;
use std::{mem, fs, env};
use std::{mem, fs};

use dirs::home_dir;
use hdrhistogram::{Histogram};
use hdrhistogram::serialization::V2DeflateSerializer;
use hdrhistogram::serialization::interval_log::{IntervalLogWriterBuilder, Tag};
@@ -51,7 +52,7 @@ impl Clone for HistLog {
impl HistLog {
pub fn new(series: &'static str, tag: &'static str, freq: Duration) -> Self {
let (tx, rx) = channel();
let mut dir = env::home_dir().unwrap();
let mut dir = home_dir().expect("home_dir");
dir.push("src/market-maker/var/hist");
fs::create_dir_all(&dir).unwrap();
let thread = Some(Arc::new(Self::scribe(series, rx, dir)));


+ 1
- 0
src/lib.rs View File

@@ -23,6 +23,7 @@ extern crate uuid;
extern crate hdrhistogram;
extern crate smallvec;
extern crate num;
extern crate dirs;
#[cfg(feature = "zmq")]
extern crate zmq;



Loading…
Cancel
Save