File tree Expand file tree Collapse file tree 6 files changed +300
-351
lines changed
Expand file tree Collapse file tree 6 files changed +300
-351
lines changed Original file line number Diff line number Diff line change @@ -183,8 +183,8 @@ impl JavaScriptSession {
183183 let state = maybe_state. as_ref ( ) . unwrap ( ) ;
184184 let start = Instant :: now ( ) ;
185185
186- if let Some ( constraints ) = options. constraints {
187- if let Some ( memory_bytes) = constraints . memory_bytes {
186+ if let Some ( limits ) = options. limits {
187+ if let Some ( memory_bytes) = limits . memory_bytes {
188188 state. rt . set_memory_limit ( memory_bytes as usize ) . await ;
189189 }
190190 }
@@ -196,7 +196,7 @@ impl JavaScriptSession {
196196 options. args. unwrap_or_default( ) ,
197197 options. env. unwrap_or_default( ) ,
198198 state. cwd. clone( ) ,
199- options. constraints . and_then( |c| c. file_size_bytes) ,
199+ options. limits . and_then( |c| c. file_size_bytes) ,
200200 ) . map_err( js_engine_error) ?;
201201 builtin:: timeout:: init_abort( ctx)
202202 } )
@@ -219,7 +219,7 @@ impl JavaScriptSession {
219219 } )
220220 . await
221221 } ;
222- let result = if let Some ( timeout_ms) = options. constraints . and_then ( |c| c. time_ms ) {
222+ let result = if let Some ( timeout_ms) = options. limits . and_then ( |c| c. time_ms ) {
223223 future
224224 . timeout ( Duration :: from_millis ( timeout_ms) )
225225 . map_err ( |err| match err. kind ( ) {
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ interface types {
2626 encoding : option <encoding >, // defaults to utf8
2727 }
2828
29- /// Resource limits and execution constraints
29+ /// Resource limits
3030 record limits {
3131 time-ms : option <u64 >,
3232 memory-bytes : option <u64 >,
@@ -64,12 +64,12 @@ interface types {
6464 /// - `stdin` is optional input to provide to the program.
6565 /// - `args` are command line arguments passed to the program.
6666 /// - `env` is a list of environment variables to set for the execution.
67- /// - `constraints ` are optional resource limits for the execution.
67+ /// - `limits ` are optional resource limits for the execution.
6868 record run-options {
6969 stdin : option <string >,
7070 args : option <list <string >>,
7171 env : option <list <tuple <string , string >>>,
72- constraints : option <limits >
72+ limits : option <limits >
7373 }
7474}
7575
@@ -109,7 +109,7 @@ interface executor {
109109 /// - `args` are command line arguments passed to the program.
110110 /// - `stdin` is optional input to provide to the program.
111111 /// - `env` is a list of environment variables to set for the execution.
112- /// - `constraints ` are optional resource limits for the execution.
112+ /// - `limits ` are optional resource limits for the execution.
113113 ///
114114 /// The returned value captures the stdout and stderr of the executed snippet.
115115 run : func (
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ interface types {
2626 encoding : option <encoding >, // defaults to utf8
2727 }
2828
29- /// Resource limits and execution constraints
29+ /// Resource limits
3030 record limits {
3131 time-ms : option <u64 >,
3232 memory-bytes : option <u64 >,
@@ -64,12 +64,12 @@ interface types {
6464 /// - `stdin` is optional input to provide to the program.
6565 /// - `args` are command line arguments passed to the program.
6666 /// - `env` is a list of environment variables to set for the execution.
67- /// - `constraints ` are optional resource limits for the execution.
67+ /// - `limits ` are optional resource limits for the execution.
6868 record run-options {
6969 stdin : option <string >,
7070 args : option <list <string >>,
7171 env : option <list <tuple <string , string >>>,
72- constraints : option <limits >
72+ limits : option <limits >
7373 }
7474}
7575
@@ -109,7 +109,7 @@ interface executor {
109109 /// - `args` are command line arguments passed to the program.
110110 /// - `stdin` is optional input to provide to the program.
111111 /// - `env` is a list of environment variables to set for the execution.
112- /// - `constraints ` are optional resource limits for the execution.
112+ /// - `limits ` are optional resource limits for the execution.
113113 ///
114114 /// The returned value captures the stdout and stderr of the executed snippet.
115115 run : func (
You can’t perform that action at this time.
0 commit comments