1+ use std:: marker:: PhantomData ;
12use std:: { cell:: RefCell , rc:: Rc , time:: Duration } ;
23
34use codspeed:: { codspeed:: CodSpeed , utils:: get_git_relative_path} ;
4- use criterion:: { measurement:: Measurement , SamplingMode , Throughput } ;
5+ use criterion:: { measurement:: Measurement , PlotConfiguration , SamplingMode , Throughput } ;
56
67use crate :: { Bencher , Criterion } ;
78
8- pub struct BenchmarkGroup {
9+ pub struct BenchmarkGroup < M : Measurement > {
910 codspeed : Rc < RefCell < CodSpeed > > ,
1011 current_file : String ,
1112 macro_group : String ,
1213 group_name : String ,
14+ phantom : PhantomData < * const M > ,
1315}
1416
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 > {
1820 codspeed : criterion
1921 . codspeed
2022 . as_ref ( )
@@ -23,6 +25,7 @@ impl BenchmarkGroup {
2325 current_file : criterion. current_file . clone ( ) ,
2426 macro_group : criterion. macro_group . clone ( ) ,
2527 group_name,
28+ phantom : PhantomData ,
2629 }
2730 }
2831
@@ -73,7 +76,7 @@ impl BenchmarkGroup {
7376
7477// Dummy methods
7578#[ allow( unused_variables) ]
76- impl BenchmarkGroup {
79+ impl < M : Measurement > BenchmarkGroup < M > {
7780 pub fn sample_size ( & mut self , n : usize ) -> & mut Self {
7881 self
7982 }
@@ -101,6 +104,9 @@ impl BenchmarkGroup {
101104 pub fn sampling_mode ( & mut self , new_mode : SamplingMode ) -> & mut Self {
102105 self
103106 }
107+ pub fn plot_config ( & mut self , new_config : PlotConfiguration ) -> & mut Self {
108+ self
109+ }
104110 pub fn finish ( self ) { }
105111}
106112
0 commit comments