Skip to content

Commit a6d4881

Browse files
authored
Merge pull request #450 from Zengor/master
Call playground with /execute
2 parents a0515bd + 3823fc0 commit a6d4881

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/theme/book.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -358,30 +358,32 @@ function run_rust_code(code_block) {
358358
result_block = code_block.find(".result");
359359
}
360360

361-
let text = playpen_text(code_block);;
362-
361+
let text = playpen_text(code_block);
362+
363363
var params = {
364-
version: "stable",
365-
optimize: "0",
366-
code: text,
367-
};
364+
channel: "stable",
365+
mode: "debug",
366+
crateType: "bin",
367+
tests: false,
368+
code: text,
369+
}
368370

369371
if(text.indexOf("#![feature") !== -1) {
370-
params.version = "nightly";
372+
params.channel = "nightly";
371373
}
372374

373375
result_block.text("Running...");
374376

375377
$.ajax({
376-
url: "https://play.rust-lang.org/evaluate.json",
378+
url: "https://play.rust-lang.org/execute",
377379
method: "POST",
378380
crossDomain: true,
379381
dataType: "json",
380382
contentType: "application/json",
381383
data: JSON.stringify(params),
382384
timeout: 15000,
383385
success: function(response){
384-
result_block.text(response.result);
386+
result_block.text(response.success ? response.stdout : response.stderr);
385387
},
386388
error: function(qXHR, textStatus, errorThrown){
387389
result_block.text("Playground communication " + textStatus);

0 commit comments

Comments
 (0)