1
+ use std:: marker:: PhantomData ;
1
2
use std:: { cell:: RefCell , rc:: Rc , time:: Duration } ;
2
3
3
4
use codspeed:: { codspeed:: CodSpeed , utils:: get_git_relative_path} ;
4
- use criterion:: { measurement:: Measurement , SamplingMode , Throughput } ;
5
+ use criterion:: { measurement:: Measurement , PlotConfiguration , SamplingMode , Throughput } ;
5
6
6
7
use crate :: { Bencher , Criterion } ;
7
8
8
- pub struct BenchmarkGroup {
9
+ pub struct BenchmarkGroup < M : Measurement > {
9
10
codspeed : Rc < RefCell < CodSpeed > > ,
10
11
current_file : String ,
11
12
macro_group : String ,
12
13
group_name : String ,
14
+ phantom : PhantomData < * const M > ,
13
15
}
14
16
15
- impl BenchmarkGroup {
16
- pub fn new < M : Measurement > ( criterion : & mut Criterion < M > , group_name : String ) -> BenchmarkGroup {
17
- BenchmarkGroup {
17
+ impl < M : Measurement > BenchmarkGroup < M > {
18
+ pub fn new ( criterion : & mut Criterion < M > , group_name : String ) -> BenchmarkGroup < M > {
19
+ BenchmarkGroup :: < M > {
18
20
codspeed : criterion
19
21
. codspeed
20
22
. as_ref ( )
@@ -23,6 +25,7 @@ impl BenchmarkGroup {
23
25
current_file : criterion. current_file . clone ( ) ,
24
26
macro_group : criterion. macro_group . clone ( ) ,
25
27
group_name,
28
+ phantom : PhantomData ,
26
29
}
27
30
}
28
31
@@ -73,7 +76,7 @@ impl BenchmarkGroup {
73
76
74
77
// Dummy methods
75
78
#[ allow( unused_variables) ]
76
- impl BenchmarkGroup {
79
+ impl < M : Measurement > BenchmarkGroup < M > {
77
80
pub fn sample_size ( & mut self , n : usize ) -> & mut Self {
78
81
self
79
82
}
@@ -101,6 +104,9 @@ impl BenchmarkGroup {
101
104
pub fn sampling_mode ( & mut self , new_mode : SamplingMode ) -> & mut Self {
102
105
self
103
106
}
107
+ pub fn plot_config ( & mut self , new_config : PlotConfiguration ) -> & mut Self {
108
+ self
109
+ }
104
110
pub fn finish ( self ) { }
105
111
}
106
112
0 commit comments