diff options
author | Mathieu David <mathieudavid@mathieudavid.org> | 2017-09-23 21:35:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-23 21:35:41 +0200 |
commit | a6d4881e00527290d8d3843376b137842c5b2833 (patch) | |
tree | 04a78c669c3b060fe790ce0ec57a2e64a5bdc6d7 | |
parent | a0515bd1042f75b4bdcb998b672084a1974092a5 (diff) | |
parent | 3823fc0e745b1fe076aacc2b6e9fcb40f597cc8a (diff) |
Merge pull request #450 from Zengor/master
Call playground with /execute
-rw-r--r-- | src/theme/book.js | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/theme/book.js b/src/theme/book.js index 56dc7425..5ac5f08a 100644 --- a/src/theme/book.js +++ b/src/theme/book.js @@ -358,22 +358,24 @@ function run_rust_code(code_block) { result_block = code_block.find(".result"); } - let text = playpen_text(code_block);; - + let text = playpen_text(code_block); + var params = { - version: "stable", - optimize: "0", - code: text, - }; + channel: "stable", + mode: "debug", + crateType: "bin", + tests: false, + code: text, + } if(text.indexOf("#![feature") !== -1) { - params.version = "nightly"; + params.channel = "nightly"; } result_block.text("Running..."); $.ajax({ - url: "https://play.rust-lang.org/evaluate.json", + url: "https://play.rust-lang.org/execute", method: "POST", crossDomain: true, dataType: "json", @@ -381,7 +383,7 @@ function run_rust_code(code_block) { data: JSON.stringify(params), timeout: 15000, success: function(response){ - result_block.text(response.result); + result_block.text(response.success ? response.stdout : response.stderr); }, error: function(qXHR, textStatus, errorThrown){ result_block.text("Playground communication " + textStatus); |