File tree Expand file tree Collapse file tree 4 files changed +11
-10
lines changed Expand file tree Collapse file tree 4 files changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ struct Inner {
1717}
1818
1919impl SerializationSink for FileSerializationSink {
20- fn from_path ( path : & Path ) -> Result < Self , Box < dyn Error > > {
20+ fn from_path ( path : & Path ) -> Result < Self , Box < dyn Error + Send + Sync > > {
2121 fs:: create_dir_all ( path. parent ( ) . unwrap ( ) ) ?;
2222
2323 let file = fs:: File :: create ( path) ?;
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ pub struct MmapSerializationSink {
1313}
1414
1515impl SerializationSink for MmapSerializationSink {
16- fn from_path ( path : & Path ) -> Result < Self , Box < dyn Error > > {
16+ fn from_path ( path : & Path ) -> Result < Self , Box < dyn Error + Send + Sync > > {
1717 // Lazily allocate 1 GB :O
1818 let file_size = 1 << 30 ;
1919
Original file line number Diff line number Diff line change @@ -15,11 +15,11 @@ pub struct ProfilerFiles {
1515}
1616
1717impl ProfilerFiles {
18- pub fn new ( path_stem : & Path ) -> ProfilerFiles {
18+ pub fn new < P : AsRef < Path > > ( path_stem : P ) -> ProfilerFiles {
1919 ProfilerFiles {
20- events_file : path_stem. with_extension ( "events" ) ,
21- string_data_file : path_stem. with_extension ( "string_data" ) ,
22- string_index_file : path_stem. with_extension ( "string_index" ) ,
20+ events_file : path_stem. as_ref ( ) . with_extension ( "events" ) ,
21+ string_data_file : path_stem. as_ref ( ) . with_extension ( "string_data" ) ,
22+ string_index_file : path_stem. as_ref ( ) . with_extension ( "string_index" ) ,
2323 }
2424 }
2525}
@@ -31,8 +31,9 @@ pub struct Profiler<S: SerializationSink> {
3131}
3232
3333impl < S : SerializationSink > Profiler < S > {
34- pub fn new ( path_stem : & Path ) -> Result < Profiler < S > , Box < dyn Error > > {
35- let paths = ProfilerFiles :: new ( path_stem) ;
34+ pub fn new < P : AsRef < Path > > ( path_stem : P )
35+ -> Result < Profiler < S > , Box < dyn Error + Send + Sync > > {
36+ let paths = ProfilerFiles :: new ( path_stem. as_ref ( ) ) ;
3637 let event_sink = Arc :: new ( S :: from_path ( & paths. events_file ) ?) ;
3738
3839 // The first thing in every file we generate must be the file header.
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ impl Addr {
1212}
1313
1414pub trait SerializationSink : Sized + Send + Sync + ' static {
15- fn from_path ( path : & Path ) -> Result < Self , Box < dyn Error > > ;
15+ fn from_path ( path : & Path ) -> Result < Self , Box < dyn Error + Send + Sync > > ;
1616
1717 /// Atomically write `num_bytes` to the sink. The implementation must ensure
1818 /// that concurrent invocations of `write_atomic` do not conflict with each
@@ -53,7 +53,7 @@ impl ByteVecSink {
5353}
5454
5555impl SerializationSink for ByteVecSink {
56- fn from_path ( _path : & Path ) -> Result < Self , Box < dyn Error > > {
56+ fn from_path ( _path : & Path ) -> Result < Self , Box < dyn Error + Send + Sync > > {
5757 unimplemented ! ( )
5858 }
5959
You can’t perform that action at this time.
0 commit comments