We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6cb8d30 commit 6178dd1Copy full SHA for 6178dd1
crates/codspeed/src/codspeed.rs
@@ -1,20 +1,11 @@
1
-use std::{ffi::CString, mem::forget, ptr};
2
-
+use crate::measurement;
3
use colored::Colorize;
+use std::ffi::CString;
4
5
-use crate::measurement;
+pub use std::hint::black_box;
6
7
pub const WARMUP_RUNS: u32 = 5;
8
9
-//TODO: use std::hint::black_box when it's stable
10
-pub fn black_box<T>(dummy: T) -> T {
11
- unsafe {
12
- let ret = ptr::read_volatile(&dummy);
13
- forget(dummy);
14
- ret
15
- }
16
-}
17
18
pub fn display_native_harness() {
19
println!("Harness: codspeed v{}", env!("CARGO_PKG_VERSION"),);
20
}
0 commit comments