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 {
17
17
}
18
18
19
19
impl 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 > > {
21
21
fs:: create_dir_all ( path. parent ( ) . unwrap ( ) ) ?;
22
22
23
23
let file = fs:: File :: create ( path) ?;
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ pub struct MmapSerializationSink {
13
13
}
14
14
15
15
impl 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 > > {
17
17
// Lazily allocate 1 GB :O
18
18
let file_size = 1 << 30 ;
19
19
Original file line number Diff line number Diff line change @@ -15,11 +15,11 @@ pub struct ProfilerFiles {
15
15
}
16
16
17
17
impl ProfilerFiles {
18
- pub fn new ( path_stem : & Path ) -> ProfilerFiles {
18
+ pub fn new < P : AsRef < Path > > ( path_stem : P ) -> ProfilerFiles {
19
19
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" ) ,
23
23
}
24
24
}
25
25
}
@@ -31,8 +31,9 @@ pub struct Profiler<S: SerializationSink> {
31
31
}
32
32
33
33
impl < 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 ( ) ) ;
36
37
let event_sink = Arc :: new ( S :: from_path ( & paths. events_file ) ?) ;
37
38
38
39
// 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 {
12
12
}
13
13
14
14
pub 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 > > ;
16
16
17
17
/// Atomically write `num_bytes` to the sink. The implementation must ensure
18
18
/// that concurrent invocations of `write_atomic` do not conflict with each
@@ -53,7 +53,7 @@ impl ByteVecSink {
53
53
}
54
54
55
55
impl 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 > > {
57
57
unimplemented ! ( )
58
58
}
59
59
You can’t perform that action at this time.
0 commit comments