1
1
#![ allow( clippy:: too_many_arguments) ]
2
2
3
+ use std:: sync:: Arc ;
3
4
use std:: time:: Instant ;
4
5
5
6
use crate :: database_logger:: { BacktraceFrame , BacktraceProvider , ModuleBacktrace , Record } ;
@@ -72,7 +73,7 @@ pub(super) struct WasmInstanceEnv {
72
73
call_times : CallTimes ,
73
74
74
75
/// The last, including current, reducer to be executed by this environment.
75
- reducer_name : String ,
76
+ reducer_name : Arc < str > ,
76
77
}
77
78
78
79
const CALL_REDUCER_ARGS_SOURCE : u32 = 1 ;
@@ -96,7 +97,7 @@ impl WasmInstanceEnv {
96
97
timing_spans : Default :: default ( ) ,
97
98
reducer_start,
98
99
call_times : CallTimes :: new ( ) ,
99
- reducer_name : String :: from ( "" ) ,
100
+ reducer_name : "" . into ( ) ,
100
101
}
101
102
}
102
103
@@ -138,7 +139,7 @@ impl WasmInstanceEnv {
138
139
///
139
140
/// Returns the handle used by reducers to read from `args`
140
141
/// as well as the handle used to write the error message, if any.
141
- pub fn start_reducer ( & mut self , name : & str , args : bytes:: Bytes ) -> ( u32 , u32 ) {
142
+ pub fn start_reducer ( & mut self , name : Arc < str > , args : bytes:: Bytes ) -> ( u32 , u32 ) {
142
143
let errors = self . setup_standard_bytes_sink ( ) ;
143
144
144
145
// Pass an invalid source when the reducer args were empty.
@@ -151,7 +152,7 @@ impl WasmInstanceEnv {
151
152
} ;
152
153
153
154
self . reducer_start = Instant :: now ( ) ;
154
- name . clone_into ( & mut self . reducer_name ) ;
155
+ self . reducer_name = name ;
155
156
156
157
( args, errors)
157
158
}
0 commit comments