mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-10-28 16:18:57 +00:00
Remove extra trait, clean up cfg statements
This commit is contained in:
1 parent
6c7e102a24
commit
cad3d0c8e4
4 files changed
+28
-23
No files matched your search
Generated
+7
@@ -31,6 +31,11 @@ name = "bitflags"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "2.29.2"
|
||||
@@ -99,6 +104,7 @@ version = "0.4.0"
|
||||
dependencies = [
|
||||
"approx 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"atty 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clap 2.29.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"colored 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"indicatif 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -416,6 +422,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum approx 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "08abcc3b4e9339e33a3d0a5ed15d84a687350c05689d825e0f6655eef9e76a94"
|
||||
"checksum atty 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "8352656fd42c30a0c3c89d26dea01e3b77c0ab2af18230835c15e2e13cd51859"
|
||||
"checksum bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b3c30d3802dfb7281680d6285f2ccdaa8c2d8fee41f93805dba5c4cf50dc23cf"
|
||||
"checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de"
|
||||
"checksum clap 2.29.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4151c5790817c7d21bbdc6c3530811f798172915f93258244948b93ba19604a6"
|
||||
"checksum clicolors-control 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1f84dec9bc083ce2503908cd305af98bd363da6f54bf8d4bf0ac14ee749ad5d1"
|
||||
"checksum colored 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b0aa3473e85a3161b59845d6096b289bb577874cafeaf75ea1b1beaa6572c7fc"
|
||||
|
||||
@@ -14,6 +14,7 @@ colored = "1.6"
|
||||
indicatif = "0.9"
|
||||
statistical = "0.1"
|
||||
atty = "0.2.2"
|
||||
cfg-if = "0.1.2"
|
||||
|
||||
[target.'cfg(not(windows))'.dependencies]
|
||||
libc = "0.2"
|
||||
|
||||
@@ -2,25 +2,16 @@ mod internal;
|
||||
|
||||
pub mod wallclocktimer;
|
||||
|
||||
#[cfg(not(windows))]
|
||||
mod unix_timer;
|
||||
|
||||
#[cfg(not(windows))]
|
||||
pub use self::unix_timer::get_cpu_timer;
|
||||
|
||||
#[cfg(windows)]
|
||||
mod windows_timer;
|
||||
|
||||
#[cfg(windows)]
|
||||
pub use self::windows_timer::get_cpu_timer;
|
||||
|
||||
use std::process::Child;
|
||||
|
||||
pub trait Timer
|
||||
where
|
||||
Self: TimerStart + TimerStop,
|
||||
{
|
||||
cfg_if! {
|
||||
if #[cfg(windows)] {
|
||||
mod windows_timer;
|
||||
pub use self::windows_timer::get_cpu_timer;
|
||||
} else {
|
||||
mod unix_timer;
|
||||
pub use self::unix_timer::get_cpu_timer;
|
||||
}
|
||||
}
|
||||
use std::process::Child;
|
||||
|
||||
/// Defines start functionality of a timer.
|
||||
pub trait TimerStart {
|
||||
|
||||
+11
-5
@@ -1,15 +1,21 @@
|
||||
extern crate atty;
|
||||
|
||||
#[macro_use]
|
||||
extern crate cfg_if;
|
||||
|
||||
#[macro_use]
|
||||
extern crate clap;
|
||||
extern crate colored;
|
||||
extern crate indicatif;
|
||||
extern crate statistical;
|
||||
|
||||
#[cfg(not(windows))]
|
||||
extern crate libc;
|
||||
|
||||
#[cfg(windows)]
|
||||
extern crate winapi;
|
||||
cfg_if! {
|
||||
if #[cfg(windows)] {
|
||||
extern crate winapi;
|
||||
} else {
|
||||
extern crate libc;
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[macro_use]
|
||||
|
||||
Reference in new issue
Block a user